|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
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 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(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. |
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(String type,
ReducedModelState state)
Virtual constructor. |
void |
setType(String type)
Reset the type of this brace. |
void |
shrink(int delta)
Braces can't shrink. |
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 String[] braces
String
public 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 modelMethod Detail |
---|
public static Brace MakeBrace(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 String getType()
getType
in class ReducedToken
public int getSize()
ReducedToken
getSize
in class ReducedToken
public String toString()
toString
in class Object
public void flip()
flip
in class ReducedToken
public boolean isOpen()
isOpen
in class ReducedToken
public boolean isOpenBrace()
ReducedToken
isOpenBrace
in class ReducedToken
public boolean isClosedBrace()
ReducedToken
isClosedBrace
in class ReducedToken
public boolean isClosed()
isClosed
in class ReducedToken
public void setType(String type)
setType
in class ReducedToken
type
- the new String type for the braceprivate static int findBrace(String type)
type
- the text of the brace
public boolean isMatch(Brace other)
isMatch
in class ReducedToken
other
- the brace to compare
public boolean isMatchable()
isMatchable
in class ReducedToken
public boolean isDoubleQuote()
ReducedToken
isDoubleQuote
in class ReducedToken
public boolean isSingleQuote()
ReducedToken
isSingleQuote
in class ReducedToken
public boolean isLineComment()
ReducedToken
isLineComment
in class ReducedToken
public boolean isBlockCommentStart()
ReducedToken
isBlockCommentStart
in class ReducedToken
public boolean isBlockCommentEnd()
ReducedToken
isBlockCommentEnd
in class ReducedToken
public boolean isNewline()
ReducedToken
isNewline
in class ReducedToken
public boolean isMultipleCharBrace()
ReducedToken
isMultipleCharBrace
in class ReducedToken
public boolean isDoubleEscapeSequence()
ReducedToken
isDoubleEscapeSequence
in class ReducedToken
public boolean isDoubleEscape()
ReducedToken
isDoubleEscape
in class ReducedToken
public boolean isEscapedDoubleQuote()
ReducedToken
isEscapedDoubleQuote
in class ReducedToken
public boolean isEscapedSingleQuote()
ReducedToken
isEscapedSingleQuote
in class ReducedToken
public boolean isGap()
isGap
in class ReducedToken
public boolean isSlash()
ReducedToken
isSlash
in class ReducedToken
public boolean isStar()
ReducedToken
isStar
in class ReducedToken
public void grow(int delta)
grow
in class ReducedToken
RuntimeException
public void shrink(int delta)
shrink
in class ReducedToken
RuntimeException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |