|
||||||||||
| 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.ReducedToken
edu.rice.cs.drjava.model.definitions.reducedmodel.Brace
class Brace
This class acts as the representation of a brace in the reduced view. It also includes information about the gap of plaintext preceding the actual brace before the previous brace or the start of the file. WARNING: the code in this class critically depends on the fact that literal strings are interned.
| Field Summary | |
|---|---|
private int |
_size
the type of this brace, which is MUTABLE via flip and setType |
private int |
_type
|
static int |
BLK_CMT_BEG_TYPE
|
static int |
BLK_CMT_END_TYPE
|
static java.lang.String[] |
braces
An array of the special characters that signify areas of text other than gaps. |
static int |
BRACES_LENGTH
|
static int |
DOUBLE_ESCAPE_TYPE
|
static int |
DOUBLE_QUOTE_TYPE
|
static int |
EOLN_TYPE
|
static int |
ESCAPED_DOUBLE_QUOTE_TYPE
|
static int |
ESCAPED_SINGLE_QUOTE_TYPE
|
static int |
LAST_BRACE_INDEX
|
static int |
LINE_CMT_TYPE
|
static int |
SINGLE_QUOTE_TYPE
|
static int |
SLASH_TYPE
|
static int |
STAR_TYPE
|
| 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 | |
|---|---|
private |
Brace(int type,
ReducedModelState state)
Constructor. |
| Method Summary | |
|---|---|
private static int |
findBrace(java.lang.String type)
Determine the brace _type of the given String. |
void |
flip()
Flips the orientation of the brace. |
int |
getSize()
Get the size of the token. |
java.lang.String |
getType()
Get the text of the brace. |
void |
grow(int delta)
Braces can't grow. |
boolean |
isBlockCommentEnd()
Determines whether the current location is the end of a block comment |
boolean |
isBlockCommentStart()
Determines if current location is the beginning of a block comment |
boolean |
isClosed()
Indicates whether this is a closing brace. |
boolean |
isClosedBrace()
Determines whether the current location is a closed brace. |
boolean |
isDoubleEscape()
Returns whether this is a double escape |
boolean |
isDoubleEscapeSequence()
Returns whether this is a double escape sequence |
boolean |
isDoubleQuote()
Returns whether this is a double quote |
boolean |
isEscapedDoubleQuote()
Return whether this is an escaped double quote |
boolean |
isEscapedSingleQuote()
Returns whether this is an escaped single quote |
boolean |
isGap()
Implementation of abstract function. |
boolean |
isLineComment()
Determines whether the current location is a line comment |
boolean |
isMatch(Brace other)
Check if two braces match. |
boolean |
isMatchable()
Determines if this Brace is matchable (one of "{", "}", "(", ")", "[", "]"). |
boolean |
isMultipleCharBrace()
Determines whether the current location is part of a multiple char brace. |
boolean |
isNewline()
Determines whether the current location is a new line. |
boolean |
isOpen()
Indicates whether this is an opening brace. |
boolean |
isOpenBrace()
Determines whether the current location is an open brace. |
boolean |
isSingleQuote()
Returns whether this is a single quote |
boolean |
isSlash()
Returns whether the current location is a slash |
boolean |
isStar()
Returns whether this is a star |
static Brace |
MakeBrace(java.lang.String type,
ReducedModelState state)
Virtual constructor. |
void |
setType(java.lang.String type)
Reset the type of this brace. |
void |
shrink(int delta)
Braces can't shrink. |
java.lang.String |
toString()
Converts a Brace to a String. |
| Methods inherited from class edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedToken |
|---|
getHighlightState, getState, isCommented, isCommentStart, isQuoted, isShadowed, setState |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String[] braces
Stringpublic static final int BRACES_LENGTH
public static final int LAST_BRACE_INDEX
public static final int BLK_CMT_BEG_TYPE
public static final int BLK_CMT_END_TYPE
public static final int EOLN_TYPE
public static final int LINE_CMT_TYPE
public static final int SINGLE_QUOTE_TYPE
public static final int DOUBLE_QUOTE_TYPE
public static final int STAR_TYPE
public static final int SLASH_TYPE
public static final int DOUBLE_ESCAPE_TYPE
public static final int ESCAPED_SINGLE_QUOTE_TYPE
public static final int ESCAPED_DOUBLE_QUOTE_TYPE
private volatile int _type
private volatile int _size
| Constructor Detail |
|---|
private Brace(int type,
ReducedModelState state)
type - the brace typestate - the state of the reduced model| Method Detail |
|---|
public static Brace MakeBrace(java.lang.String type,
ReducedModelState state)
type - the brace textstate - whether the brace is shadwowed by a comment, quote etc
BraceException - if the given type is not a valid brace type.public java.lang.String getType()
getType in class ReducedTokenpublic int getSize()
ReducedToken
getSize in class ReducedTokenpublic java.lang.String toString()
toString in class java.lang.Objectpublic void flip()
flip in class ReducedTokenpublic boolean isOpen()
isOpen in class ReducedTokenpublic boolean isOpenBrace()
ReducedToken
isOpenBrace in class ReducedTokenpublic boolean isClosedBrace()
ReducedToken
isClosedBrace in class ReducedTokenpublic boolean isClosed()
isClosed in class ReducedTokenpublic void setType(java.lang.String type)
setType in class ReducedTokentype - the new String type for the braceprivate static int findBrace(java.lang.String type)
type - the text of the brace
public boolean isMatch(Brace other)
isMatch in class ReducedTokenother - the brace to compare
public boolean isMatchable()
isMatchable in class ReducedTokenpublic boolean isDoubleQuote()
ReducedToken
isDoubleQuote in class ReducedTokenpublic boolean isSingleQuote()
ReducedToken
isSingleQuote in class ReducedTokenpublic boolean isLineComment()
ReducedToken
isLineComment in class ReducedTokenpublic boolean isBlockCommentStart()
ReducedToken
isBlockCommentStart in class ReducedTokenpublic boolean isBlockCommentEnd()
ReducedToken
isBlockCommentEnd in class ReducedTokenpublic boolean isNewline()
ReducedToken
isNewline in class ReducedTokenpublic boolean isMultipleCharBrace()
ReducedToken
isMultipleCharBrace in class ReducedTokenpublic boolean isDoubleEscapeSequence()
ReducedToken
isDoubleEscapeSequence in class ReducedTokenpublic boolean isDoubleEscape()
ReducedToken
isDoubleEscape in class ReducedTokenpublic boolean isEscapedDoubleQuote()
ReducedToken
isEscapedDoubleQuote in class ReducedTokenpublic boolean isEscapedSingleQuote()
ReducedToken
isEscapedSingleQuote in class ReducedTokenpublic boolean isGap()
isGap in class ReducedTokenpublic boolean isSlash()
ReducedToken
isSlash in class ReducedTokenpublic boolean isStar()
ReducedToken
isStar in class ReducedTokenpublic void grow(int delta)
grow in class ReducedTokenjava.lang.RuntimeExceptionpublic void shrink(int delta)
shrink in class ReducedTokenjava.lang.RuntimeException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||