|
||||||||||
| 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.ModelList.ModelIterator
edu.rice.cs.drjava.model.definitions.reducedmodel.TokenList.Iterator
public class TokenList.Iterator
| Field Summary | |
|---|---|
private int |
_offset
|
| Constructor Summary | |
|---|---|
|
TokenList.Iterator()
|
private |
TokenList.Iterator(TokenList.Iterator that)
|
| Method Summary | |
|---|---|
private int |
_calculateOffset(int delToSizePrev,
String delToTypePrev,
int delToSizeCurr,
String delToTypeCurr,
TokenList.Iterator delTo)
By comparing the delTo token after the walk to what it was before the walk we can see how it has changed and where the offset should go. Prev is the item previous to the current cursor. |
private boolean |
_checkPrevEquals(TokenList.Iterator delTo,
String match)
Checks if the previous token is of a certain type. |
private int |
_delete(int count,
TokenList.Iterator copyCursor)
Helper function for delete. |
private int |
_move(int count,
int currentOffset)
Helper function for move(int). |
private int |
_moveLeft(int count,
int currentOffset)
Helper function that moves cursor ([iterator pos, count]) backward by count chars. |
private int |
_moveRight(int count,
int currentOffset)
Helper function that moves cursor ([iterator pos, count]) forward by count chars. |
(package private) void |
_splitCurrentIfCommentBlock(boolean splitClose,
boolean splitEscape)
Splits the current brace if it is a multiple character brace and fulfills certain conditions. |
(package private) void |
clipLeft()
Gets rid of extra text. |
(package private) void |
clipRight()
Gets rid of extra text. |
TokenList.Iterator |
copy()
Makes a fresh copy of this TokenList.Iterator. |
void |
delete(int count)
Update the BraceReduction to reflect text deletion. |
(package private) int |
deleteRight(TokenList.Iterator delTo)
Deletes from offset in this to endOffset in delTo. |
int |
getBlockOffset()
|
ReducedModelState |
getStateAtCurrent()
Returns the current commented/quoted state at the cursor. |
(package private) void |
insertBraceToGap(String text)
Handles the details of the case where a brace is inserted into a gap. |
(package private) void |
insertNewBrace(String text)
Helper function to _insertBrace. |
void |
move(int count)
Updates the BraceReduction to reflect cursor movement. |
void |
setBlockOffset(int offset)
|
void |
setTo(TokenList.Iterator that)
|
String |
toString()
|
(package private) void |
updateBasedOnCurrentState()
Walks along the list on which ReducedModel is based from the current cursor position. |
| Methods inherited from class edu.rice.cs.drjava.model.definitions.reducedmodel.ModelList.ModelIterator |
|---|
atEnd, atFirstItem, atLastItem, atStart, collapse, current, dispose, eq, insert, next, nextItem, pos, prev, prevItem, remove, setTo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int _offset
| Constructor Detail |
|---|
public TokenList.Iterator()
private TokenList.Iterator(TokenList.Iterator that)
| Method Detail |
|---|
public TokenList.Iterator copy()
copy in class ModelList.ModelIteratorpublic void setTo(TokenList.Iterator that)
public int getBlockOffset()
public void setBlockOffset(int offset)
public ReducedModelState getStateAtCurrent()
void insertBraceToGap(String text)
void insertNewBrace(String text)
void _splitCurrentIfCommentBlock(boolean splitClose,
boolean splitEscape)
void updateBasedOnCurrentState()
public void move(int count)
count - indicates the direction and magnitude of cursor movement
private int _move(int count,
int currentOffset)
count - the number of chars to move. Negative values move back, positive values move forward.currentOffset - the current offset for copyCursor
private int _moveRight(int count,
int currentOffset)
private int _moveLeft(int count,
int currentOffset)
public void delete(int count)
Update the BraceReduction to reflect text deletion.
count - A number specifying the size and direction of text deletion. Negative values delete text to the
left of the cursor; positive values delete text to the right. Assumes deletion is within range!
private int _delete(int count,
TokenList.Iterator copyCursor)
count - size of deletioncopyCursor - cursor iterator
void clipLeft()
void clipRight()
int deleteRight(TokenList.Iterator delTo)
private int _calculateOffset(int delToSizePrev,
String delToTypePrev,
int delToSizeCurr,
String delToTypeCurr,
TokenList.Iterator delTo)
private boolean _checkPrevEquals(TokenList.Iterator delTo,
String match)
delTo - the cursor for calling prevItem onmatch - the type we want to check
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||