|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.model.definitions.reducedmodel.AbstractReducedModel
public abstract class AbstractReducedModel
A refactoring of the common code between ReducedModelComment and ReducedModelBrace. Both of the refactored classes extend this class.
| Field Summary | |
|---|---|
(package private) TokenList.Iterator |
_cursor
Keeps track of cursor position in document. |
(package private) TokenList |
_tokens
The reduced model for a document is a list of ReducedTokens (braces and gaps). |
static char |
PTR_CHAR
The character that represents the cursor in toString(). |
| Fields inherited from interface edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedModelStates |
|---|
FREE, INSIDE_BLOCK_COMMENT, INSIDE_DOUBLE_QUOTE, INSIDE_LINE_COMMENT, INSIDE_SINGLE_QUOTE, STUTTER |
| Constructor Summary | |
|---|---|
AbstractReducedModel()
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
_augmentCurrentGap(int length)
Assuming there is a gap to the right, this function increases the size of that gap. |
protected void |
_augmentGapToLeft(int length)
Assuming there is a gap to the left, this function increases the size of that gap. |
protected boolean |
_gapToLeft()
Determines if there is a gap immediately to the left of the cursor. |
protected boolean |
_gapToRight()
Determines if there is a Gap immediately to the right of the cursor. |
void |
_insertGap(int length)
Inserts a block of text into the reduced model which has no special consideration in the reduced model. |
protected void |
_insertNewGap(int length)
Helper function for _insertGap. |
int |
absOffset()
Absolute offset for testing purposes. |
int |
absOffset(TokenList.Iterator cursor)
Absolute offset of the specified iterator. |
protected ReducedToken |
current()
Get the ReducedToken currently pointed at by the cursor. |
(package private) int |
getBlockOffset()
Get the offset into the current ReducedToken. |
int |
getLength()
|
ReducedModelState |
getState()
|
abstract void |
insertChar(char ch)
Inserts a character into the reduced model. |
protected abstract void |
insertGapBetweenMultiCharBrace(int length)
Inserts a gap between a multiple character brace. |
TokenList.Iterator |
makeCopyCursor()
Make a copy of the token list's iterator. |
protected abstract ReducedModelState |
moveWalkerGetState(int relLocation)
Returns the state at the relLocation, where relLocation is the location relative to the walker. |
protected void |
next()
Move to the token immediately right. |
protected void |
prev()
Move to the token immediately left. |
protected abstract void |
resetWalkerLocationToCursor()
Resets the walker to the current position in document. |
(package private) void |
setBlockOffset(int offset)
Change the offset into the current ReducedToken. |
String |
simpleString()
A toString() replacement for testing - easier to read. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final char PTR_CHAR
TokenList _tokens
TokenList.Iterator _cursor
| Constructor Detail |
|---|
public AbstractReducedModel()
| Method Detail |
|---|
int getBlockOffset()
void setBlockOffset(int offset)
offset - the number of characters into the token to set the cursorpublic int absOffset()
public int absOffset(TokenList.Iterator cursor)
public int getLength()
public ReducedModelState getState()
public String simpleString()
public abstract void insertChar(char ch)
public void _insertGap(int length)
length - the length of the inserted textprotected abstract void insertGapBetweenMultiCharBrace(int length)
public TokenList.Iterator makeCopyCursor()
protected boolean _gapToRight()
protected boolean _gapToLeft()
protected void _augmentGapToLeft(int length)
length - the amount of increaseprotected void _augmentCurrentGap(int length)
length - the amount of increaseprotected void _insertNewGap(int length)
length - size of gap to insertprotected abstract ReducedModelState moveWalkerGetState(int relLocation)
relLocation - distance from walker to get state at.protected abstract void resetWalkerLocationToCursor()
protected ReducedToken current()
protected void next()
protected void prev()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||