|
||||||||||
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
edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedModelBrace
public class 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 |
---|
Fields inherited from class edu.rice.cs.drjava.model.definitions.reducedmodel.AbstractReducedModel |
---|
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 | |
---|---|
protected BraceInfo |
_getEnclosingBrace()
Determines the brace enclosing the current location. |
BraceInfo |
_getLineEnclosingBrace()
Determines the brace (type and distance) enclosing the beginning of the current line (except the first line). |
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. |
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. |
boolean |
isShadowed()
|
void |
move(int count)
Updates ReducedModelBrace to reflect cursor movement. |
protected ReducedModelState |
moveWalkerGetState(int relDistance)
Returns the state at the relLocation, where relLocation is the location relative to the walker. |
int |
nextBrace()
Determines the distance to the location before the next open brace. |
boolean |
openBraceImmediatelyLeft()
|
int |
previousBrace()
Returns distance from current location of cursor to the location of the previous significant brace including opening comment braces (but not closing ones since they are not "FREE"). |
protected void |
resetWalkerLocationToCursor()
Resets the walker to the current position in document. |
Methods inherited from class edu.rice.cs.drjava.model.definitions.reducedmodel.AbstractReducedModel |
---|
_augmentCurrentGap, _augmentGapToLeft, _gapToLeft, _gapToRight, _insertGap, _insertNewGap, absOffset, absOffset, current, getLength, getState, makeCopyCursor, next, prev, simpleString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReducedModelBrace(ReducedModelControl parent)
Method Detail |
---|
public void insertChar(char ch)
AbstractReducedModel
insertChar
in class AbstractReducedModel
protected 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)
public boolean isShadowed()
public int previousBrace()
public int nextBrace()
public int balanceForward()
public boolean openBraceImmediatelyLeft()
public boolean closedBraceImmediatelyLeft()
public int balanceBackward()
protected ReducedModelState moveWalkerGetState(int relDistance)
AbstractReducedModel
moveWalkerGetState
in class AbstractReducedModel
relDistance
- distance from walker to get state at.protected void resetWalkerLocationToCursor()
AbstractReducedModel
resetWalkerLocationToCursor
in class AbstractReducedModel
public BraceInfo _getLineEnclosingBrace()
protected BraceInfo _getEnclosingBrace()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |