ru.biosoft.math.model
Class DefaultParserContext

java.lang.Object
  extended byru.biosoft.math.model.DefaultParserContext
All Implemented Interfaces:
ParserContext

public class DefaultParserContext
extends java.lang.Object
implements ParserContext


Field Summary
static java.lang.String ABS
           
static java.lang.String ACOS
           
static java.lang.String AND
           
static java.lang.String ARCCOSH
           
static java.lang.String ARCCOT
           
static java.lang.String ARCCOTH
           
static java.lang.String ARCCSCH
           
static java.lang.String ARCSCS
           
static java.lang.String ARCSEC
           
static java.lang.String ARCSECH
           
static java.lang.String ARCSINH
           
static java.lang.String ARCTANH
           
static java.lang.String ASIN
           
static java.lang.String ASSIGNMENT
           
static java.lang.String ATAN
           
static java.lang.String CEIL
           
static java.lang.String CONST_E
           
static java.lang.String CONST_FALSE
           
static java.lang.String CONST_PI
           
static java.lang.String CONST_TRUE
           
protected  java.util.HashMap constantsMap
           
static java.lang.String COS
           
static java.lang.String COSH
           
static java.lang.String COT
           
static java.lang.String COTH
           
static java.lang.String CSC
           
static java.lang.String CSCH
           
static java.lang.String DIFF
           
static java.lang.String DIVIDE
           
static java.lang.String EQ
           
static java.lang.String EXP
           
static java.lang.String FACTORIAL
           
static java.lang.String FLOOR
           
protected  java.util.HashMap functionsMap
           
static java.lang.String GEQ
           
static java.lang.String GT
           
static java.lang.String LEQ
           
static java.lang.String LN
           
static java.lang.String LOG
           
static java.lang.String LT
           
static java.lang.String MINUS
           
static java.lang.String NEQ
           
static java.lang.String NOT
           
static java.lang.String OR
          Declares standard operators:
static java.lang.String PLUS
           
static java.lang.String POWER
           
static java.lang.String ROOT
           
static java.lang.String SEC
           
static java.lang.String SECH
           
static java.lang.String SIN
           
static java.lang.String SINH
           
protected  java.util.HashMap substitutionMap
           
static java.lang.String TAN
           
static java.lang.String TANH
           
static java.lang.String TIMES
           
static java.lang.String UMINUS
           
protected  java.util.HashMap variablesMap
           
static java.lang.String XOR
           
 
Constructor Summary
DefaultParserContext()
           
 
Method Summary
 boolean containsConstant(java.lang.String name)
           
 boolean containsVariable(java.lang.String name)
           
 void declareConstant(java.lang.String name, java.lang.Object value)
          Declares the constant.
 void declareFunction(Function function)
          Declares the function.
 void declareFunctionNameSubstitution(java.lang.String name, java.lang.String replaceBy)
           
static void declareStandardConstants(ParserContext context)
          Declares standard constants: true, false, pi, ...
static void declareStandardOperators(ParserContext context)
           
 void declareVariable(java.lang.String name, java.lang.Object value)
          Declares the variable.
 java.lang.Object getConstantValue(java.lang.String name)
          Returns the constant value or null if constant not declared.
 Function getFunction(java.lang.String name)
          Returns function or operator with the specified name or null if function is not declared.
 ParserContext getParentContext()
           
 java.lang.Object getVariableValue(java.lang.String name)
          Returns value of variable with the specified name or null if variable is not declared.
 void setParentContext(ParserContext parent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONST_TRUE

public static final java.lang.String CONST_TRUE
See Also:
Constant Field Values

CONST_FALSE

public static final java.lang.String CONST_FALSE
See Also:
Constant Field Values

CONST_PI

public static final java.lang.String CONST_PI
See Also:
Constant Field Values

CONST_E

public static final java.lang.String CONST_E
See Also:
Constant Field Values

constantsMap

protected java.util.HashMap constantsMap

variablesMap

protected java.util.HashMap variablesMap

substitutionMap

protected java.util.HashMap substitutionMap

functionsMap

protected java.util.HashMap functionsMap

OR

public static final java.lang.String OR
Declares standard operators:

See Also:
Constant Field Values
To do:
implement properly, declare operator names as constants

AND

public static final java.lang.String AND
See Also:
Constant Field Values

NOT

public static final java.lang.String NOT
See Also:
Constant Field Values

XOR

public static final java.lang.String XOR
See Also:
Constant Field Values

GT

public static final java.lang.String GT
See Also:
Constant Field Values

LT

public static final java.lang.String LT
See Also:
Constant Field Values

GEQ

public static final java.lang.String GEQ
See Also:
Constant Field Values

LEQ

public static final java.lang.String LEQ
See Also:
Constant Field Values

EQ

public static final java.lang.String EQ
See Also:
Constant Field Values

NEQ

public static final java.lang.String NEQ
See Also:
Constant Field Values

PLUS

public static final java.lang.String PLUS
See Also:
Constant Field Values

MINUS

public static final java.lang.String MINUS
See Also:
Constant Field Values

UMINUS

public static final java.lang.String UMINUS
See Also:
Constant Field Values

TIMES

public static final java.lang.String TIMES
See Also:
Constant Field Values

DIVIDE

public static final java.lang.String DIVIDE
See Also:
Constant Field Values

POWER

public static final java.lang.String POWER
See Also:
Constant Field Values

ROOT

public static final java.lang.String ROOT
See Also:
Constant Field Values

ABS

public static final java.lang.String ABS
See Also:
Constant Field Values

EXP

public static final java.lang.String EXP
See Also:
Constant Field Values

LN

public static final java.lang.String LN
See Also:
Constant Field Values

LOG

public static final java.lang.String LOG
See Also:
Constant Field Values

SIN

public static final java.lang.String SIN
See Also:
Constant Field Values

COS

public static final java.lang.String COS
See Also:
Constant Field Values

TAN

public static final java.lang.String TAN
See Also:
Constant Field Values

COT

public static final java.lang.String COT
See Also:
Constant Field Values

ASIN

public static final java.lang.String ASIN
See Also:
Constant Field Values

ACOS

public static final java.lang.String ACOS
See Also:
Constant Field Values

ATAN

public static final java.lang.String ATAN
See Also:
Constant Field Values

ARCCOSH

public static final java.lang.String ARCCOSH
See Also:
Constant Field Values

ARCSINH

public static final java.lang.String ARCSINH
See Also:
Constant Field Values

ARCCOT

public static final java.lang.String ARCCOT
See Also:
Constant Field Values

ARCCOTH

public static final java.lang.String ARCCOTH
See Also:
Constant Field Values

ARCSCS

public static final java.lang.String ARCSCS
See Also:
Constant Field Values

ARCCSCH

public static final java.lang.String ARCCSCH
See Also:
Constant Field Values

ARCSEC

public static final java.lang.String ARCSEC
See Also:
Constant Field Values

ARCSECH

public static final java.lang.String ARCSECH
See Also:
Constant Field Values

ARCTANH

public static final java.lang.String ARCTANH
See Also:
Constant Field Values

COSH

public static final java.lang.String COSH
See Also:
Constant Field Values

COTH

public static final java.lang.String COTH
See Also:
Constant Field Values

CSC

public static final java.lang.String CSC
See Also:
Constant Field Values

CSCH

public static final java.lang.String CSCH
See Also:
Constant Field Values

SEC

public static final java.lang.String SEC
See Also:
Constant Field Values

SECH

public static final java.lang.String SECH
See Also:
Constant Field Values

SINH

public static final java.lang.String SINH
See Also:
Constant Field Values

TANH

public static final java.lang.String TANH
See Also:
Constant Field Values

DIFF

public static final java.lang.String DIFF
See Also:
Constant Field Values

ASSIGNMENT

public static final java.lang.String ASSIGNMENT
See Also:
Constant Field Values

FLOOR

public static final java.lang.String FLOOR
See Also:
Constant Field Values

CEIL

public static final java.lang.String CEIL
See Also:
Constant Field Values

FACTORIAL

public static final java.lang.String FACTORIAL
See Also:
Constant Field Values
Constructor Detail

DefaultParserContext

public DefaultParserContext()
Method Detail

getParentContext

public ParserContext getParentContext()

setParentContext

public void setParentContext(ParserContext parent)

containsConstant

public boolean containsConstant(java.lang.String name)
Specified by:
containsConstant in interface ParserContext

getConstantValue

public java.lang.Object getConstantValue(java.lang.String name)
Description copied from interface: ParserContext
Returns the constant value or null if constant not declared.

Specified by:
getConstantValue in interface ParserContext

declareConstant

public void declareConstant(java.lang.String name,
                            java.lang.Object value)
Description copied from interface: ParserContext
Declares the constant.

Specified by:
declareConstant in interface ParserContext

declareStandardConstants

public static void declareStandardConstants(ParserContext context)
Declares standard constants: true, false, pi, ...

To do:
implement properly

containsVariable

public boolean containsVariable(java.lang.String name)
Specified by:
containsVariable in interface ParserContext

getVariableValue

public java.lang.Object getVariableValue(java.lang.String name)
Description copied from interface: ParserContext
Returns value of variable with the specified name or null if variable is not declared.

Specified by:
getVariableValue in interface ParserContext

declareVariable

public void declareVariable(java.lang.String name,
                            java.lang.Object value)
Description copied from interface: ParserContext
Declares the variable.

Specified by:
declareVariable in interface ParserContext

getFunction

public Function getFunction(java.lang.String name)
Description copied from interface: ParserContext
Returns function or operator with the specified name or null if function is not declared.

Specified by:
getFunction in interface ParserContext

declareFunction

public void declareFunction(Function function)
Description copied from interface: ParserContext
Declares the function.

Specified by:
declareFunction in interface ParserContext

declareFunctionNameSubstitution

public void declareFunctionNameSubstitution(java.lang.String name,
                                            java.lang.String replaceBy)

declareStandardOperators

public static void declareStandardOperators(ParserContext context)


Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.