de.dante.extex.interpreter.expression.term
Class TDouble

java.lang.Object
  extended byde.dante.extex.interpreter.expression.term.TDouble
All Implemented Interfaces:
EType

public class TDouble
extends java.lang.Object
implements EType

This implementation of a Terminal encapsulates a floating point number.

Version:
$Revision: 1.1 $
Author:
Gerd Neugebauer

Constructor Summary
TDouble()
          Creates a new object.
TDouble(double d)
          Creates a new object.
 
Method Summary
 EType add(EType t)
          Apply the operation + on the current instance and an additional argument.
 EType and(EType t)
          Apply the operation && on the current instance and an additional argument.
protected static double castTerminal(EType t)
          Cast a terminal to a double.
 EType divide(EType t)
          Apply the operation + on the current instance and an additional argument.
 TBoolean eq(EType t)
          Compare the current instance with an another value for equality.
 TBoolean ge(EType t)
          Compare the current instance with an another value for greater or equal.
 double getValue()
          Getter for value.
 TBoolean gt(EType t)
          Compare the current instance with an another value for greater than.
 TBoolean le(EType t)
          Compare the current instance with an another value for less or equal.
 TBoolean lt(EType t)
          Compare the current instance with an another value for less.
 EType multiply(EType t)
          Apply the operation * on the current instance and an additional argument.
 TBoolean ne(EType t)
          Compare the current instance with an another value for not equal.
 EType negate()
          Apply the unary minus - on the current instance.
 EType not()
          Apply the unary negation ! on the current instance.
 EType or(EType t)
          Apply the operation || on the current instance and an additional argument.
 EType parse(java.lang.CharSequence sequence)
           
 EType set(EType t)
          Assign a new value from an additional argument.
protected  void setValue(double value)
          Setter for value.
 EType subtract(EType t)
          Apply the operation - on the current instance and an additional argument.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TDouble

public TDouble()
Creates a new object.


TDouble

public TDouble(double d)
Creates a new object.

Parameters:
d - the value
Method Detail

castTerminal

protected static double castTerminal(EType t)
                              throws CastException
Cast a terminal to a double.

Parameters:
t - the terminal to cast
Returns:
the double encountered
Throws:
CastException - in case of an error

add

public EType add(EType t)
          throws CastException
Description copied from interface: EType
Apply the operation + on the current instance and an additional argument.

Specified by:
add in interface EType
Parameters:
t - the terminal to add
Returns:
the result of the operation
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.add( de.dante.extex.interpreter.expression.EType)

and

public EType and(EType t)
          throws CastException,
                 UnsupportedException
Description copied from interface: EType
Apply the operation && on the current instance and an additional argument.

Specified by:
and in interface EType
Parameters:
t - the terminal to build the conjunction with
Returns:
the result of the operation
Throws:
UnsupportedException - in case of an unsupported operation
CastException - in case of an error in casing the argument
See Also:
EType.and( de.dante.extex.interpreter.expression.EType)

divide

public EType divide(EType t)
             throws CastException,
                    ArithmeticOverflowException
Description copied from interface: EType
Apply the operation + on the current instance and an additional argument.

Specified by:
divide in interface EType
Parameters:
t - the terminal to divide by
Returns:
the result of the operation
Throws:
CastException - in case of an error in casing the argument
ArithmeticOverflowException - in case of a division by zero
See Also:
EType.divide( de.dante.extex.interpreter.expression.EType)

eq

public TBoolean eq(EType t)
            throws CastException
Description copied from interface: EType
Compare the current instance with an another value for equality.

Specified by:
eq in interface EType
Parameters:
t - the terminal to compare to
Returns:
the result of the comparison
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.eq( de.dante.extex.interpreter.expression.EType)

ge

public TBoolean ge(EType t)
            throws CastException
Description copied from interface: EType
Compare the current instance with an another value for greater or equal.

Specified by:
ge in interface EType
Parameters:
t - the terminal to compare to
Returns:
the result of the comparison
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.ge( de.dante.extex.interpreter.expression.EType)

getValue

public double getValue()
Getter for value.

Returns:
the value

gt

public TBoolean gt(EType t)
            throws CastException
Description copied from interface: EType
Compare the current instance with an another value for greater than.

Specified by:
gt in interface EType
Parameters:
t - the terminal to compare to
Returns:
the result of the comparison
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.gt( de.dante.extex.interpreter.expression.EType)

le

public TBoolean le(EType t)
            throws CastException
Description copied from interface: EType
Compare the current instance with an another value for less or equal.

Specified by:
le in interface EType
Parameters:
t - the terminal to compare to
Returns:
the result of the comparison
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.le( de.dante.extex.interpreter.expression.EType)

lt

public TBoolean lt(EType t)
            throws CastException
Description copied from interface: EType
Compare the current instance with an another value for less.

Specified by:
lt in interface EType
Parameters:
t - the terminal to compare to
Returns:
the result of the comparison
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.lt( de.dante.extex.interpreter.expression.EType)

multiply

public EType multiply(EType t)
               throws CastException
Description copied from interface: EType
Apply the operation * on the current instance and an additional argument.

Specified by:
multiply in interface EType
Parameters:
t - the terminal to multiply
Returns:
the result of the operation
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.multiply( de.dante.extex.interpreter.expression.EType)

ne

public TBoolean ne(EType t)
            throws CastException
Description copied from interface: EType
Compare the current instance with an another value for not equal.

Specified by:
ne in interface EType
Parameters:
t - the terminal to compare to
Returns:
the result of the comparison
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.ne( de.dante.extex.interpreter.expression.EType)

negate

public EType negate()
Description copied from interface: EType
Apply the unary minus - on the current instance.

Specified by:
negate in interface EType
Returns:
the result of the operation
See Also:
EType.negate()

not

public EType not()
          throws UnsupportedException
Description copied from interface: EType
Apply the unary negation ! on the current instance.

Specified by:
not in interface EType
Returns:
the result of the operation
Throws:
UnsupportedException - in case of an unsupported operation
See Also:
EType.not()

or

public EType or(EType t)
         throws CastException,
                UnsupportedException
Description copied from interface: EType
Apply the operation || on the current instance and an additional argument.

Specified by:
or in interface EType
Parameters:
t - the terminal to build the disjunction with
Returns:
the result of the operation
Throws:
UnsupportedException - in case of an unsupported operation
CastException - in case of an error in casing the argument
See Also:
EType.or( de.dante.extex.interpreter.expression.EType)

parse

public EType parse(java.lang.CharSequence sequence)
See Also:
de.dante.extex.interpreter.expression.EType#parse( java.lang.CharSequence)

set

public EType set(EType t)
          throws CastException
Description copied from interface: EType
Assign a new value from an additional argument. The argument is casted into the proper type.

Specified by:
set in interface EType
Parameters:
t - the terminal to build the conjunction with
Returns:
the result of the operation
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.set( de.dante.extex.interpreter.expression.EType)

setValue

protected void setValue(double value)
Setter for value.

Parameters:
value - the value to set

subtract

public EType subtract(EType t)
               throws CastException
Description copied from interface: EType
Apply the operation - on the current instance and an additional argument.

Specified by:
subtract in interface EType
Parameters:
t - the terminal to subtract
Returns:
the result of the operation
Throws:
CastException - in case of an error in casing the argument
See Also:
EType.subtract( de.dante.extex.interpreter.expression.EType)

toString

public java.lang.String toString()
See Also:
Object.toString()