Venice 0.7beta

org.mov.parser
Class Token

java.lang.Object
  extended by org.mov.parser.Token

public class Token
extends java.lang.Object

A representation of any token in the Gondola language.

Author:
Andrew Leppard

Field Summary
static int ABS_TOKEN
          Represents "abs" symbol
static int ADD_TOKEN
          Represents "+" symbol
static int AND_TOKEN
          Represents "and" symbol
static int AVG_TOKEN
          Represents "avg" symbol
static int BBL_TOKEN
          Represents "bol_lower()" symbol
static int BBU_TOKEN
          Represents "bol_upper()" symbol
static int BOOLEAN_TOKEN
          Represents "boolean" symbol
static int COMMA_TOKEN
          Represents "," symbol
static int CONSTANT_TOKEN
          Represents "const" symbol
static int CORR_TOKEN
          Represents "corr()" symbol
static int COS_TOKEN
          Represents "cos()" symbol
static int DAY_CLOSE_TOKEN
          Represents "close" symbol
static int DAY_HIGH_TOKEN
          Represents "high" symbol
static int DAY_LOW_TOKEN
          Represents "low" symbol
static int DAY_OF_WEEK_TOKEN
          Represents "dayofweek()" symbol
static int DAY_OF_YEAR_TOKEN
          Represents "dayofyear()" symbol
static int DAY_OPEN_TOKEN
          Represents "open" symbol
static int DAY_TOKEN
          Represents "day()" symbol
static int DAY_VOLUME_TOKEN
          Represents "volume" symbol
static int DIVIDE_TOKEN
          Represents "/" symbol
static int ELSE_TOKEN
          Represents "else" symbol
static int EMA_TOKEN
          Represents "ema()" symbol
static int EQUAL_TOKEN
          Represents "==" symbol
static int EXP_TOKEN
          Represents "exp()" symbol
static int FALSE_TOKEN
          Represents "false" symbol
static int FLOAT_TOKEN
          Represents "float" symbol
static int FOR_TOKEN
          Represents "flor" symbol
static int FULLSTOP_TOKEN
          Represents ".
static int GREATER_THAN_EQUAL_TOKEN
          Represents ">=" symbol
static int GREATER_THAN_TOKEN
          Represents ">" symbol
static int IF_TOKEN
          Represents "if" symbol
static int INTEGER_TOKEN
          Represents "int" symbol
static int LAG_TOKEN
          Represents "lag" symbol
static int LEFT_BRACE_TOKEN
          Represents "{" symbol
static int LEFT_PARENTHESIS_TOKEN
          Represents "(" symbol
static int LESS_THAN_EQUAL_TOKEN
          Represents "<=" symbol
static int LESS_THAN_TOKEN
          Represents "<" symbol
static int LOG_TOKEN
          Represents "log()" symbol
static int MACD_TOKEN
          Represents "macd()" symbol
static int MAX_TOKEN
          Represents "max" symbol
static int MIN_TOKEN
          Represents "min" symbol
static int MOMENTUM_TOKEN
          Represents "momentum()" symbol
static int MONTH_TOKEN
          Represents "month()" symbol
static int MULTIPLY_TOKEN
          Represents "*" symbol
static int NOT_EQUAL_TOKEN
          Represents "!
static int NOT_TOKEN
          Represents "not" symbol
static int NUMBER_TOKEN
          Represents a number symbol
static int OBV_TOKEN
          Represents "obv()" symbol
static int OR_TOKEN
          Represents "or" symbol
static int PERCENT_TOKEN
          Represents "percent" symbol
static int RIGHT_BRACE_TOKEN
          Represents "}" symbol
static int RIGHT_PARENTHESIS_TOKEN
          Represents ")" symbol
static int RSI_TOKEN
          Represents "rsi" symbol
static int SD_TOKEN
          Represents "sd()" symbol
static int SEMICOLON_TOKEN
          Represents ";" symbol
static int SET_TOKEN
          Represents "=" symbol
static int SIN_TOKEN
          Represents "sin()" symbol
static int SQRT_TOKEN
          Represents "sqrt" symbol
static int STRING_TOKEN
          Represents a string
static int SUBTRACT_TOKEN
          Represents "-" symbol
static int SUM_TOKEN
          Represents "sum" symbol
static int TREND_TOKEN
          Represents "trend()" symbol
static int TRUE_TOKEN
          Represents "true" symbol
static int VARIABLE_TOKEN
          Represents a variable
static int WHILE_TOKEN
          Represents "while" symbol
static int YEAR_TOKEN
          Represents "year()" symbol
 
Constructor Summary
Token()
          Create a new empty token.
 
Method Summary
 java.lang.String getStringValue()
          For string tokens, get the value.
 int getType()
          Get the type of this token.
 double getValue()
          For number tokens, get the value.
 int getValueType()
          For NUMBER_TOKEN get the type.
 java.lang.String getVariableName()
          For variable token, get the name.
 void negate()
          For NUMBER_TOKEN, negate the value.
 void setType(int type)
          Set the type of this token.
static java.lang.String stringToToken(Variables variables, Token token, java.lang.String string)
          Perform lexical analysis on the given string.
static java.lang.String[] wordsOfGondola()
          Return a string containing all the words of Gondola language.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_PARENTHESIS_TOKEN

public static final int LEFT_PARENTHESIS_TOKEN
Represents "(" symbol

See Also:
Constant Field Values

RIGHT_PARENTHESIS_TOKEN

public static final int RIGHT_PARENTHESIS_TOKEN
Represents ")" symbol

See Also:
Constant Field Values

LESS_THAN_EQUAL_TOKEN

public static final int LESS_THAN_EQUAL_TOKEN
Represents "<=" symbol

See Also:
Constant Field Values

GREATER_THAN_EQUAL_TOKEN

public static final int GREATER_THAN_EQUAL_TOKEN
Represents ">=" symbol

See Also:
Constant Field Values

LESS_THAN_TOKEN

public static final int LESS_THAN_TOKEN
Represents "<" symbol

See Also:
Constant Field Values

GREATER_THAN_TOKEN

public static final int GREATER_THAN_TOKEN
Represents ">" symbol

See Also:
Constant Field Values

EQUAL_TOKEN

public static final int EQUAL_TOKEN
Represents "==" symbol

See Also:
Constant Field Values

ADD_TOKEN

public static final int ADD_TOKEN
Represents "+" symbol

See Also:
Constant Field Values

SUBTRACT_TOKEN

public static final int SUBTRACT_TOKEN
Represents "-" symbol

See Also:
Constant Field Values

MULTIPLY_TOKEN

public static final int MULTIPLY_TOKEN
Represents "*" symbol

See Also:
Constant Field Values

DIVIDE_TOKEN

public static final int DIVIDE_TOKEN
Represents "/" symbol

See Also:
Constant Field Values

OR_TOKEN

public static final int OR_TOKEN
Represents "or" symbol

See Also:
Constant Field Values

AND_TOKEN

public static final int AND_TOKEN
Represents "and" symbol

See Also:
Constant Field Values

NOT_TOKEN

public static final int NOT_TOKEN
Represents "not" symbol

See Also:
Constant Field Values

COMMA_TOKEN

public static final int COMMA_TOKEN
Represents "," symbol

See Also:
Constant Field Values

LAG_TOKEN

public static final int LAG_TOKEN
Represents "lag" symbol

See Also:
Constant Field Values

MIN_TOKEN

public static final int MIN_TOKEN
Represents "min" symbol

See Also:
Constant Field Values

MAX_TOKEN

public static final int MAX_TOKEN
Represents "max" symbol

See Also:
Constant Field Values

AVG_TOKEN

public static final int AVG_TOKEN
Represents "avg" symbol

See Also:
Constant Field Values

DAY_OPEN_TOKEN

public static final int DAY_OPEN_TOKEN
Represents "open" symbol

See Also:
Constant Field Values

DAY_CLOSE_TOKEN

public static final int DAY_CLOSE_TOKEN
Represents "close" symbol

See Also:
Constant Field Values

DAY_LOW_TOKEN

public static final int DAY_LOW_TOKEN
Represents "low" symbol

See Also:
Constant Field Values

DAY_HIGH_TOKEN

public static final int DAY_HIGH_TOKEN
Represents "high" symbol

See Also:
Constant Field Values

DAY_VOLUME_TOKEN

public static final int DAY_VOLUME_TOKEN
Represents "volume" symbol

See Also:
Constant Field Values

IF_TOKEN

public static final int IF_TOKEN
Represents "if" symbol

See Also:
Constant Field Values

LEFT_BRACE_TOKEN

public static final int LEFT_BRACE_TOKEN
Represents "{" symbol

See Also:
Constant Field Values

RIGHT_BRACE_TOKEN

public static final int RIGHT_BRACE_TOKEN
Represents "}" symbol

See Also:
Constant Field Values

FULLSTOP_TOKEN

public static final int FULLSTOP_TOKEN
Represents "." symbol

See Also:
Constant Field Values

ELSE_TOKEN

public static final int ELSE_TOKEN
Represents "else" symbol

See Also:
Constant Field Values

PERCENT_TOKEN

public static final int PERCENT_TOKEN
Represents "percent" symbol

See Also:
Constant Field Values

NOT_EQUAL_TOKEN

public static final int NOT_EQUAL_TOKEN
Represents "!=" symbol

See Also:
Constant Field Values

RSI_TOKEN

public static final int RSI_TOKEN
Represents "rsi" symbol

See Also:
Constant Field Values

TRUE_TOKEN

public static final int TRUE_TOKEN
Represents "true" symbol

See Also:
Constant Field Values

FALSE_TOKEN

public static final int FALSE_TOKEN
Represents "false" symbol

See Also:
Constant Field Values

DAY_OF_WEEK_TOKEN

public static final int DAY_OF_WEEK_TOKEN
Represents "dayofweek()" symbol

See Also:
Constant Field Values

DAY_OF_YEAR_TOKEN

public static final int DAY_OF_YEAR_TOKEN
Represents "dayofyear()" symbol

See Also:
Constant Field Values

DAY_TOKEN

public static final int DAY_TOKEN
Represents "day()" symbol

See Also:
Constant Field Values

MONTH_TOKEN

public static final int MONTH_TOKEN
Represents "month()" symbol

See Also:
Constant Field Values

YEAR_TOKEN

public static final int YEAR_TOKEN
Represents "year()" symbol

See Also:
Constant Field Values

SUM_TOKEN

public static final int SUM_TOKEN
Represents "sum" symbol

See Also:
Constant Field Values

SQRT_TOKEN

public static final int SQRT_TOKEN
Represents "sqrt" symbol

See Also:
Constant Field Values

ABS_TOKEN

public static final int ABS_TOKEN
Represents "abs" symbol

See Also:
Constant Field Values

CONSTANT_TOKEN

public static final int CONSTANT_TOKEN
Represents "const" symbol

See Also:
Constant Field Values

BOOLEAN_TOKEN

public static final int BOOLEAN_TOKEN
Represents "boolean" symbol

See Also:
Constant Field Values

INTEGER_TOKEN

public static final int INTEGER_TOKEN
Represents "int" symbol

See Also:
Constant Field Values

FLOAT_TOKEN

public static final int FLOAT_TOKEN
Represents "float" symbol

See Also:
Constant Field Values

SET_TOKEN

public static final int SET_TOKEN
Represents "=" symbol

See Also:
Constant Field Values

SEMICOLON_TOKEN

public static final int SEMICOLON_TOKEN
Represents ";" symbol

See Also:
Constant Field Values

FOR_TOKEN

public static final int FOR_TOKEN
Represents "flor" symbol

See Also:
Constant Field Values

WHILE_TOKEN

public static final int WHILE_TOKEN
Represents "while" symbol

See Also:
Constant Field Values

CORR_TOKEN

public static final int CORR_TOKEN
Represents "corr()" symbol

See Also:
Constant Field Values

EMA_TOKEN

public static final int EMA_TOKEN
Represents "ema()" symbol

See Also:
Constant Field Values

BBL_TOKEN

public static final int BBL_TOKEN
Represents "bol_lower()" symbol

See Also:
Constant Field Values

BBU_TOKEN

public static final int BBU_TOKEN
Represents "bol_upper()" symbol

See Also:
Constant Field Values

MACD_TOKEN

public static final int MACD_TOKEN
Represents "macd()" symbol

See Also:
Constant Field Values

MOMENTUM_TOKEN

public static final int MOMENTUM_TOKEN
Represents "momentum()" symbol

See Also:
Constant Field Values

OBV_TOKEN

public static final int OBV_TOKEN
Represents "obv()" symbol

See Also:
Constant Field Values

SD_TOKEN

public static final int SD_TOKEN
Represents "sd()" symbol

See Also:
Constant Field Values

SIN_TOKEN

public static final int SIN_TOKEN
Represents "sin()" symbol

See Also:
Constant Field Values

COS_TOKEN

public static final int COS_TOKEN
Represents "cos()" symbol

See Also:
Constant Field Values

LOG_TOKEN

public static final int LOG_TOKEN
Represents "log()" symbol

See Also:
Constant Field Values

EXP_TOKEN

public static final int EXP_TOKEN
Represents "exp()" symbol

See Also:
Constant Field Values

TREND_TOKEN

public static final int TREND_TOKEN
Represents "trend()" symbol

See Also:
Constant Field Values

NUMBER_TOKEN

public static final int NUMBER_TOKEN
Represents a number symbol

See Also:
Constant Field Values

VARIABLE_TOKEN

public static final int VARIABLE_TOKEN
Represents a variable

See Also:
Constant Field Values

STRING_TOKEN

public static final int STRING_TOKEN
Represents a string

See Also:
Constant Field Values
Constructor Detail

Token

public Token()
Create a new empty token.

Method Detail

wordsOfGondola

public static java.lang.String[] wordsOfGondola()
Return a string containing all the words of Gondola language.

Returns:
the string of words

stringToToken

public static java.lang.String stringToToken(Variables variables,
                                             Token token,
                                             java.lang.String string)
                                      throws ParserException
Perform lexical analysis on the given string. Extract the first symbol found from the given string, set the passed token object to represent this symbol then return the given string sans the extracted symbol.

Parameters:
variables - variables that will be assumed to be defined for the equation
token - the token to use to represent the first symbol found
string - the string to extract the first symbol from
Returns:
the string minus the first symbol
Throws:
ParserException

getType

public int getType()
Get the type of this token.

Returns:
the type

setType

public void setType(int type)
Set the type of this token.

Parameters:
type - the new type

getValue

public double getValue()
For number tokens, get the value.

Returns:
the value.

getStringValue

public java.lang.String getStringValue()
For string tokens, get the value.

Returns:
the value.

getVariableName

public java.lang.String getVariableName()
For variable token, get the name.

Returns:
the name.

getValueType

public int getValueType()
For NUMBER_TOKEN get the type.

Returns:
the type.

negate

public void negate()
For NUMBER_TOKEN, negate the value.


Venice 0.7beta