|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.cs.drjava.model.definitions.reducedmodel.AbstractReducedModel | +--edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedModelBrace
Keeps track of the true braces (i.e., "(){}[]"). This reduced sub-model is used to balance braces for both indenting and highlighting purposes. For example, when the user's caret is immediately after a closing brace, this allows the DefinitionsPane to produced a highlight extending from the closing brace to its match.
Field Summary | |
private ReducedModelControl |
_parent
|
Fields inherited from class edu.rice.cs.drjava.model.definitions.reducedmodel.AbstractReducedModel |
_cursor, _tokens, PTR_CHAR |
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 | |
ReducedModelBrace(ReducedModelControl parent)
|
Method Summary | |
private void |
_insertBrace(String text)
Helper function for top level brace insert functions. |
private boolean |
_isCurrentBraceMatchable()
If the current brace is a /, a *, a // or a \n, it's not matchable. |
int |
balanceBackward()
|
int |
balanceForward()
If the current ReducedToken is an open significant brace and the offset is 0 (i.e., if we're immediately left of said brace), push the current Brace onto a Stack and iterate forwards, keeping track of the distance covered. |
boolean |
closedBraceImmediatelyLeft()
|
void |
delete(int count)
Updates ReducedModelBrace to reflect text deletion. |
protected void |
getDistToEnclosingBrace(IndentInfo braceInfo)
|
protected void |
getDistToEnclosingBraceCurrent(IndentInfo braceInfo)
Find the enclosing brace enclosing our current location. |
void |
insertChar(char ch)
Inserts a character into the reduced model. |
protected void |
insertGapBetweenMultiCharBrace(int length)
Inserts a gap between the characters in a multiple character brace. |
void |
move(int count)
Updates ReducedModelBrace to reflect cursor movement. |
int |
nextBrace()
Goes to the location before the brace. |
boolean |
openBraceImmediatelyRight()
|
int |
previousBrace()
Returns distance from current location of cursor to the location of the previous significant brace. |
protected void |
resetLocation()
Resets the walker to the current position in document |
protected ReducedModelState |
stateAtRelLocation(int relDistance)
Returns the state at the relLocation, where relLocation is the location relative to the walker |
Methods inherited from class edu.rice.cs.drjava.model.definitions.reducedmodel.AbstractReducedModel |
_augmentCurrentGap, _augmentGapToLeft, _gapToLeft, _gapToRight, _insertGap, _insertNewGap, absOffset, current, getBlockOffset, getStateAtCurrent, makeCopyCursor, next, prev, setBlockOffset, simpleString |
Methods inherited from class java.lang.Object |
|
Field Detail |
private ReducedModelControl _parent
Constructor Detail |
public ReducedModelBrace(ReducedModelControl parent)
Method Detail |
public void insertChar(char ch)
AbstractReducedModel
insertChar
in class AbstractReducedModel
private void _insertBrace(String text)
text
- the String type of the brace to insertprotected void insertGapBetweenMultiCharBrace(int length)
insertGapBetweenMultiCharBrace
in class AbstractReducedModel
public void move(int count)
count
- indicates the direction and magnitude of cursor movementpublic void delete(int count)
private boolean _isCurrentBraceMatchable()
public int previousBrace()
public int nextBrace()
public int balanceForward()
public boolean openBraceImmediatelyRight()
public boolean closedBraceImmediatelyLeft()
public int balanceBackward()
protected ReducedModelState stateAtRelLocation(int relDistance)
AbstractReducedModel
stateAtRelLocation
in class AbstractReducedModel
edu.rice.cs.drjava.model.definitions.reducedmodel.AbstractReducedModel
relLocation
- distance from walker to get state at.protected void resetLocation()
AbstractReducedModel
resetLocation
in class AbstractReducedModel
protected void getDistToEnclosingBrace(IndentInfo braceInfo)
protected void getDistToEnclosingBraceCurrent(IndentInfo braceInfo)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |