|
||||||||||
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.ReducedModelControl
This class provides an implementation of the BraceReduction interface for brace matching. In order to correctly match, this class keeps track of what is commented (line and block) and what is inside double quotes and keeps this in mind when matching. To avoid unnecessary complication, this class maintains a few invariants for its consistent states, i.e., between top-level function calls.
Field Summary | |
(package private) int |
_offset
|
(package private) ReducedModelBrace |
rmb
|
(package private) ReducedModelComment |
rmc
|
Constructor Summary | |
ReducedModelControl()
|
Method Summary | |
int |
absOffset()
Gets the absolute character offset into the document represented by the reduced model. |
(package private) boolean |
atEnd()
Determines if the cursor is at the end of the reduced model. |
(package private) boolean |
atStart()
Determines if the cursor is at the start of the reduced model. |
int |
balanceBackward()
Finds the open brace that matches the previous significant brace iff that brace is an closing brace. |
int |
balanceForward()
Finds the closing brace that matches the next significant brace iff that brace is an open brace. |
ReducedToken |
currentToken()
Get the token currently pointed at by the cursor. |
void |
delete(int count)
Update the BraceReduction to reflect text deletion. |
(package private) int |
getBlockOffset()
Gets the offset within the current token. |
int |
getDistToNextNewline()
Gets distance to next new line. |
int |
getDistToPreviousNewline(int relLoc)
Gets distance to end of line on the line previous. |
gj.util.Vector |
getHighlightStatus(int start,
int length)
Return all highlight status info for text between the current location and current location + end. |
IndentInfo |
getIndentInformation()
Returns an IndentInfo containing the following information: - distance to the previous newline ( start of this line) - distance to the brace enclosing the beginning of the current line - distance to the beginning of the line containing that brace |
(package private) int |
getSize()
Gets the size of the current token. |
(package private) int |
getSize(ReducedToken rmbToken,
ReducedToken rmcToken)
|
ReducedModelState |
getStateAtCurrent()
Get the shadowing state at the current caret position. |
(package private) String |
getType()
Get a string representation of the current token's type. |
void |
insertChar(char ch)
Insert a character into the BraceReduction. |
void |
move(int count)
Updates the BraceReduction to reflect cursor movement. |
(package private) void |
next()
Move the reduced model to the next token and update the cursor information. |
ReducedToken |
nextItem()
Get the next token. |
(package private) void |
prev()
Move the reduced model to the previous token and update the cursor information. |
ReducedToken |
prevItem()
Get the previous token. |
void |
resetLocation()
This function resets the location of the walker in the comment list to where the current cursor is. |
String |
simpleString()
A toString() substitute. |
ReducedModelState |
stateAtRelLocation(int relDistance)
This function returns the state at the relDistance, where relDistance is relative to the last time it was called. |
Methods inherited from class java.lang.Object |
|
Field Detail |
ReducedModelBrace rmb
ReducedModelComment rmc
int _offset
Constructor Detail |
public ReducedModelControl()
Method Detail |
public void insertChar(char ch)
BraceReduction
insertChar
in interface BraceReduction
edu.rice.cs.drjava.model.definitions.reducedmodel.BraceReduction
ch
- the character to be insertedpublic void move(int count)
Updates the BraceReduction to reflect cursor movement. Negative values move left from the cursor, positive values move right.
move
in interface BraceReduction
count
- indicates the direction and magnitude of cursor movementpublic void delete(int count)
Update the BraceReduction to reflect text deletion.
delete
in interface BraceReduction
count
- indicates the size and direction of text deletion.
Negative values delete text to the left of the cursor, positive
values delete text to the right.public int balanceForward()
Finds the closing brace that matches the next significant brace iff that brace is an open brace.
balanceForward
in interface BraceReduction
#nextBrace()
public int balanceBackward()
Finds the open brace that matches the previous significant brace iff that brace is an closing brace.
balanceBackward
in interface BraceReduction
#previousBrace()
public ReducedModelState stateAtRelLocation(int relDistance)
stateAtRelLocation
in interface BraceReduction
edu.rice.cs.drjava.model.definitions.reducedmodel.BraceReduction
relLocation
- distance from walker to get state at.public void resetLocation()
resetLocation
in interface BraceReduction
public ReducedToken currentToken()
currentToken
in interface BraceReduction
public ReducedModelState getStateAtCurrent()
getStateAtCurrent
in interface BraceReduction
String getType()
int getSize()
int getSize(ReducedToken rmbToken, ReducedToken rmcToken)
void next()
void prev()
public ReducedToken prevItem()
public ReducedToken nextItem()
boolean atEnd()
boolean atStart()
int getBlockOffset()
public int absOffset()
absOffset
in interface BraceReduction
public String simpleString()
simpleString
in interface BraceReduction
public IndentInfo getIndentInformation()
getIndentInformation
in interface BraceReduction
public int getDistToPreviousNewline(int relLoc)
getDistToPreviousNewline
in interface BraceReduction
public int getDistToNextNewline()
BraceReduction
getDistToNextNewline
in interface BraceReduction
public gj.util.Vector getHighlightStatus(int start, int length)
getHighlightStatus
in interface BraceReduction
start
- The starting location of the area we want to get status of.
The reduced model is already at this position, but the
parameter is needed to determine the absolute positions
needed in the HighlightStatus objects we return.length
- How far should we generate info for?
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |