|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sc3d.apt.sss.v3.Token org.sc3d.apt.sss.v3.Bracket
public class Bracket
A subclass of Token that represents a string of zero or more Tokens enclosed in brackets. The 'type' field of instances of Bracket will be 'TYPE_BRACKET', 'TYPE_SQUARE' or 'TYPE_BRACE'.
Field Summary | |
---|---|
Token |
closing
One of the bracket Tokens passed to the constructor. |
int |
length
The number of Tokens nested inside this Bracket. |
Token |
opening
One of the bracket Tokens passed to the constructor. |
Fields inherited from class org.sc3d.apt.sss.v3.Token |
---|
sentence, start, type, TYPE_BRACE, TYPE_CHAR, TYPE_COMMENT, TYPE_CONSTANT, TYPE_IDENTIFIER, TYPE_NUMBER, TYPE_ROUND, TYPE_SQUARE, TYPE_STRING, TYPE_WORD |
Constructor Summary | |
---|---|
Bracket(Sentence sentence,
Token opening,
Token[] tokens,
Token closing)
Constructs a Bracket. |
Method Summary | |
---|---|
Token |
get(int index)
Returns the Token with index 'index' inside this Bracket. |
static boolean |
matches(Token opening,
Token closing)
Returns 'true' if 'opening' is an open round bracket and 'closing' is a close round bracket, or if 'opening' is an open square bracket and 'closing' is a close square bracket, or if 'opening' is an open brace and 'closing' is a close brace. |
Token[] |
toArray()
Returns the Tokens inside this Bracket in a fresh array. |
Methods inherited from class org.sc3d.apt.sss.v3.Token |
---|
addError, equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final Token opening
public final Token closing
public final int length
Constructor Detail |
---|
public Bracket(Sentence sentence, Token opening, Token[] tokens, Token closing)
opening
- the Token which represents the open bracket.tokens
- the Tokens inside the brackets. This array is not copied away, and must therefore not be modified hereafter.closing
- the Token which represents the close bracket.Method Detail |
---|
public Token get(int index)
public Token[] toArray()
public static boolean matches(Token opening, Token closing)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |