QScript  2.1.2
Expression and algorithm evaluator
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
org.qscript.Argument Class Reference

Inherits org.qscript.Token.

Inherited by org.qscript.FlowAction, and org.qscript.Variable.

Public Member Functions

 Argument (Object v)
 
boolean equals (Object o)
 
Object getValue ()
 
boolean isArgument ()
 
boolean isNan ()
 
Vector toVector_ () throws EvaluationException
 
Vector toVector ()
 
Complex toComplex_ () throws EvaluationException
 
Complex toComplex ()
 
boolean toBoolean_ () throws EvaluationException
 
boolean toBoolean ()
 
double toDouble_ () throws EvaluationException
 
double toDouble ()
 
float toFloat_ () throws EvaluationException
 
float toFloat ()
 
int toInteger_ () throws EvaluationException
 
int toInteger ()
 
String toString ()
 
- Public Member Functions inherited from org.qscript.Token
void setTextPosition (int charStart, int charWidth)
 
void setTextPosition (int line, int charStart, int charWidth)
 
int getLine ()
 
int getCharStart ()
 
int getCharWidth ()
 
boolean isArgument ()
 
boolean isFlowAction ()
 
boolean isVariable ()
 
boolean isThing ()
 
boolean isOperator ()
 
boolean isFlowOperator ()
 
String forListing ()
 

Public Attributes

final boolean isNull
 
final boolean isString
 
final boolean isInteger
 
final boolean isDouble
 
final boolean isBoolean
 
final boolean isVector
 
final boolean isComplex
 
final boolean isThing
 
final boolean isNumeric
 

Additional Inherited Members

- Static Public Attributes inherited from org.qscript.Token
static final Token DUMMY = new Argument(null)
 
- Protected Member Functions inherited from org.qscript.Token
 Token ()
 
- Protected Attributes inherited from org.qscript.Token
int line
 
int charStart
 
int charWidth
 

Detailed Description

An argument represents a dynamically typed un-named value and is used to store the intermediate and final results of an expression evaluation.

Internally a value will either be null or one of these data types :-

When creating an Argument or setting its value, the (new) value to be used will be converted (if necessary) into one of the supported types.

will be converted to Integer

will be converted to Double

char / Character will be converted to String

Any other object type will result in the value being null.

Author
Peter Lager

Constructor & Destructor Documentation

org.qscript.Argument.Argument ( Object  v)

Create an Argument to act as the operand for the various operators

Parameters
vthe value to store in this argument.

Member Function Documentation

Object org.qscript.Argument.getValue ( )

Get the value stored in this Argument.

boolean org.qscript.Argument.isArgument ( )

Returns true

boolean org.qscript.Argument.isNan ( )

If the value is of type Double and it is Not a Number (NaN) then return true. In all other circumstances return false.

boolean org.qscript.Argument.toBoolean ( )

Get the Boolean value of the base object if a direct conversion can take place. If the base object cannot be converted to a Boolean then display an error message and return false.

Returns
Boolean interpretation of the base object.
boolean org.qscript.Argument.toBoolean_ ( ) throws EvaluationException

Get the Boolean interpretation of the base object if a direct conversion can take place.

Returns
Boolean interpretation of the base object.
Exceptions
EvaluationExceptionif the base object is not a Boolean or cannot be converted to a Boolean
Complex org.qscript.Argument.toComplex ( )

Get the Complex number value of the base object. If the base object is not of type Complex then display an error message and return false.

Returns
complex number value of the base object.
Complex org.qscript.Argument.toComplex_ ( ) throws EvaluationException

Get the Complex number value of the base object. If the base object is not of type Complex then throw an exception

Returns
complex number value of the base object.
Exceptions
EvaluationExceptionif the base object is not a Complex
double org.qscript.Argument.toDouble ( )

Get the Double value of the base object if a direct conversion can take place. If the base object cannot be converted to a Double then display an error message and return zero.

Returns
Double interpretation of the base object.
double org.qscript.Argument.toDouble_ ( ) throws EvaluationException

Attempt to convert the base object to a Boolean.

Exceptions
EvaluationExceptionif the base object cannot be converted to a Boolean Get the Double interpretation of the base object if a direct conversion can take place.
Returns
Double interpretation of the base object.
Exceptions
EvaluationExceptionif the base object is not a Double or cannot be converted to a Double
float org.qscript.Argument.toFloat ( )

Get the Float value of the base object if a direct conversion can take place. If the base object cannot be converted to a Float then display an error message and return zero.

Returns
Float interpretation of the base object.
float org.qscript.Argument.toFloat_ ( ) throws EvaluationException

Attempt to convert the base object to a Double.

Exceptions
EvaluationExceptionif the base object cannot be converted to a Double Get the Float interpretation of the base object if a direct conversion can take place.
Returns
Float interpretation of the base object.
Exceptions
EvaluationExceptionif the base object is not a Float or cannot be converted to a Float
int org.qscript.Argument.toInteger ( )

Get the Integer value of the base object if a direct conversion can take place. If the base object cannot be converted to an Integer then display an error message and return zero.

Returns
Double interpretation of the base object.
int org.qscript.Argument.toInteger_ ( ) throws EvaluationException

Attempt to convert the base object to a Float.

Exceptions
EvaluationExceptionif the base object cannot be converted to a Float Get an Integer interpretation of the base object if a direct conversion can take place.
Returns
Integer interpretation of the base object.
Exceptions
EvaluationExceptionif the base object is not an Integer or cannot be converted to an Integer
String org.qscript.Argument.toString ( )

Attempt to convert the base object to an Integer.

Exceptions
EvaluationExceptionif the base object cannot be converted to an Integer Convert the base object to a String.
Vector org.qscript.Argument.toVector ( )

Get the Vector value of the base object. If the base object is not of type Vector then display an error message and return false.

Returns
vector value of the base object.
Vector org.qscript.Argument.toVector_ ( ) throws EvaluationException

Get the Vector value of the base object. If the base object is not of type Vector then throw an exception

Returns
vector value of the base object.
Exceptions
EvaluationExceptionif the base object is not a Vector

The documentation for this class was generated from the following file: