Package cc.redberry.rings.io
Class Tokenizer
- java.lang.Object
-
- cc.redberry.rings.io.Tokenizer
-
- All Implemented Interfaces:
Serializable
public final class Tokenizer extends Object implements Serializable
Simple math expression tokenizer- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceTokenizer.CharacterStreamStream of chars.static classTokenizer.TokenSimple tokenstatic classTokenizer.TokenTypetoken type
-
Field Summary
Fields Modifier and Type Field Description static Tokenizer.TokenBRACKET_CLOSEstatic Tokenizer.TokenBRACKET_OPENstatic Tokenizer.TokenDIVIDEstatic Tokenizer.TokenENDstatic Tokenizer.TokenEXPONENTstatic Tokenizer.TokenMINUSstatic Tokenizer.TokenMULTIPLYstatic Tokenizer.TokenPLUSstatic Tokenizer.TokenSPACE
-
Constructor Summary
Constructors Constructor Description Tokenizer(Tokenizer.CharacterStream stream)Create tokenizer of a given char stream
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Tokenizer.CharacterStreamconcat(Tokenizer.CharacterStream a, Tokenizer.CharacterStream b)Concat char streamsstatic Tokenizer.CharacterStreammkCharacterStream(String string, Character terminateChar)Create character stream from stringstatic TokenizermkTokenizer(String string)Create string tokenizerstatic TokenizermkTokenizer(String string, Character terminateChar)Create string tokenizerTokenizer.TokennextToken()Get the next token from stream
-
-
-
Field Detail
-
END
public static final Tokenizer.Token END
-
PLUS
public static final Tokenizer.Token PLUS
-
MINUS
public static final Tokenizer.Token MINUS
-
MULTIPLY
public static final Tokenizer.Token MULTIPLY
-
DIVIDE
public static final Tokenizer.Token DIVIDE
-
EXPONENT
public static final Tokenizer.Token EXPONENT
-
BRACKET_OPEN
public static final Tokenizer.Token BRACKET_OPEN
-
BRACKET_CLOSE
public static final Tokenizer.Token BRACKET_CLOSE
-
SPACE
public static final Tokenizer.Token SPACE
-
-
Constructor Detail
-
Tokenizer
public Tokenizer(Tokenizer.CharacterStream stream)
Create tokenizer of a given char stream
-
-
Method Detail
-
nextToken
public Tokenizer.Token nextToken()
Get the next token from stream
-
concat
public static Tokenizer.CharacterStream concat(Tokenizer.CharacterStream a, Tokenizer.CharacterStream b)
Concat char streams
-
mkCharacterStream
public static Tokenizer.CharacterStream mkCharacterStream(String string, Character terminateChar)
Create character stream from string- Parameters:
terminateChar- if a non-null value specified, stream will terminate on the last char preceding theterminateChar
-
mkTokenizer
public static Tokenizer mkTokenizer(String string, Character terminateChar)
Create string tokenizer- Parameters:
terminateChar- if a non-null value specified, stream will terminate on the last char preceding theterminateChar
-
-