Java Doc for GapVector.java in  » 6.0-JDK-Core » swing » javax » swing » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.text.GapVector

All known Subclasses:   javax.swing.text.GapContent,
GapVector
abstract class GapVector implements Serializable(Code)
An implementation of a gapped buffer similar to that used by emacs. The underlying storage is a java array of some type, which is known only by the subclass of this class. The array has a gap somewhere. The gap is moved to the location of changes to take advantage of common behavior where most changes occur in the same location. Changes that occur at a gap boundary are generally cheap and moving the gap is generally cheaper than moving the array contents directly to accomodate the change.
author:
   Timothy Prinzing
version:
   1.19 05/05/07
See Also:   GapContent



Constructor Summary
public  GapVector()
     Creates a new GapVector object.
public  GapVector(int initialLength)
     Creates a new GapVector object, with the initial size specified.

Method Summary
abstract protected  ObjectallocateArray(int len)
     Allocate an array to store items of the type appropriate (which is determined by the subclass).
 voidclose(int position, int nItems)
     Delete nItems at position.
final protected  ObjectgetArray()
     Access to the array.
abstract protected  intgetArrayLength()
    
final protected  intgetGapEnd()
     Access to the end of the gap.
final protected  intgetGapStart()
     Access to the start of the gap.
 intgetNewArraySize(int reqSize)
     Calculates a new size of the storage array depending on required capacity.
 intopen(int position, int nItems)
     Make space for the given number of items at the given location.
protected  voidreplace(int position, int rmSize, Object addItems, int addSize)
     Replace the given logical position in the storage with the given new items.
 voidresize(int nsize)
    
protected  voidshiftEnd(int newSize)
    
protected  voidshiftGap(int newGapStart)
     Move the start of the gap to a new location, without changing the size of the gap.
protected  voidshiftGapEndUp(int newGapEnd)
     Adjust the gap end upward.
protected  voidshiftGapStartDown(int newGapStart)
     Adjust the gap end downward.


Constructor Detail
GapVector
public GapVector()(Code)
Creates a new GapVector object. Initial size defaults to 10.



GapVector
public GapVector(int initialLength)(Code)
Creates a new GapVector object, with the initial size specified.
Parameters:
  initialLength - the initial size




Method Detail
allocateArray
abstract protected Object allocateArray(int len)(Code)
Allocate an array to store items of the type appropriate (which is determined by the subclass).



close
void close(int position, int nItems)(Code)
Delete nItems at position. Squeezes any marks within the deleted area to position. This moves the gap to the best place by minimizing it's overall movement. The gap must intersect the target block.



getArray
final protected Object getArray()(Code)
Access to the array. The actual type of the array is known only by the subclass.



getArrayLength
abstract protected int getArrayLength()(Code)
Get the length of the allocated array



getGapEnd
final protected int getGapEnd()(Code)
Access to the end of the gap.



getGapStart
final protected int getGapStart()(Code)
Access to the start of the gap.



getNewArraySize
int getNewArraySize(int reqSize)(Code)
Calculates a new size of the storage array depending on required capacity.
Parameters:
  reqSize - the size which is necessary for new content the new size of the storage array



open
int open(int position, int nItems)(Code)
Make space for the given number of items at the given location. the location that the caller should fill in



replace
protected void replace(int position, int rmSize, Object addItems, int addSize)(Code)
Replace the given logical position in the storage with the given new items. This will move the gap to the area being changed if the gap is not currently located at the change location.
Parameters:
  position - the location to make the replacement. Thisis not the location in the underlying storage array, butthe location in the contiguous space being modeled.
Parameters:
  rmSize - the number of items to remove
Parameters:
  addItems - the new items to place in storage.



resize
void resize(int nsize)(Code)
resize the underlying storage array to the given new size



shiftEnd
protected void shiftEnd(int newSize)(Code)
Make the gap bigger, moving any necessary data and updating the appropriate marks



shiftGap
protected void shiftGap(int newGapStart)(Code)
Move the start of the gap to a new location, without changing the size of the gap. This moves the data in the array and updates the marks accordingly.



shiftGapEndUp
protected void shiftGapEndUp(int newGapEnd)(Code)
Adjust the gap end upward. This doesn't move any data, but it does update any marks affected by the boundary change. All marks from the old gap end up to the new gap end are squeezed to the end of the gap (their location has been removed).



shiftGapStartDown
protected void shiftGapStartDown(int newGapStart)(Code)
Adjust the gap end downward. This doesn't move any data, but it does update any marks affected by the boundary change. All marks from the old gap start down to the new gap start are squeezed to the end of the gap (their location has been removed).



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.