jpel.language
Class ExpressionNumber

java.lang.Object
  |
  +--jpel.language.AbstractExpression
        |
        +--jpel.language.ExpressionObject
              |
              +--jpel.language.ExpressionNumber
All Implemented Interfaces:
ComparableExpression, Expression, java.io.Serializable, StringableExpression

public class ExpressionNumber
extends ExpressionObject
implements StringableExpression, ComparableExpression

Representa o tipo numérico da linguagem. Tipos aceitos: byte, short, int, long, float, double.

See Also:
Serialized Form

Field Summary
static int BYTE
           
static int DOUBLE
           
static int FLOAT
           
static int INT
           
static int LONG
           
static jpel.language.ExpressionNumber MAX_BYTE
           
static jpel.language.ExpressionNumber MAX_DOUBLE
           
static jpel.language.ExpressionNumber MAX_FLOAT
           
static jpel.language.ExpressionNumber MAX_INT
           
static jpel.language.ExpressionNumber MAX_LONG
           
static jpel.language.ExpressionNumber MAX_SHORT
           
static jpel.language.ExpressionNumber MIN_BYTE
           
static jpel.language.ExpressionNumber MIN_DOUBLE
           
static jpel.language.ExpressionNumber MIN_FLOAT
           
static jpel.language.ExpressionNumber MIN_INT
           
static jpel.language.ExpressionNumber MIN_LONG
           
static jpel.language.ExpressionNumber MIN_SHORT
           
static int SHORT
           
 
Constructor Summary
ExpressionNumber(byte value)
           
ExpressionNumber(java.lang.Byte value)
           
ExpressionNumber(double value)
           
ExpressionNumber(java.lang.Double value)
           
ExpressionNumber(float value)
           
ExpressionNumber(java.lang.Float value)
           
ExpressionNumber(int value)
           
ExpressionNumber(java.lang.Integer value)
           
ExpressionNumber(long value)
           
ExpressionNumber(java.lang.Long value)
           
ExpressionNumber(short value)
           
ExpressionNumber(java.lang.Short value)
           
ExpressionNumber(java.lang.String value)
           
 
Method Summary
 jpel.language.ExpressionNumber add(jpel.language.ExpressionNumber number)
           
 java.lang.String asString()
          Fornece uma representação em String da expressão.
 int bestMatch(jpel.language.ExpressionNumber number)
           
 boolean canBeByte()
           
 boolean canBeDouble()
           
 boolean canBeFloat()
           
 boolean canBeInt()
           
 boolean canBeLong()
           
 boolean canBeShort()
           
 int compareTo(jpel.language.ComparableExpression expression)
          Indicates a order relation throught instances of the same type.
 jpel.language.ExpressionNumber div(jpel.language.ExpressionNumber number)
           
 byte getByte()
           
 java.lang.Object getData(java.lang.Class type)
          Retorna o dado associado à expressão.
 double getDouble()
           
 float getFloat()
           
 int getInt()
           
 long getLong()
           
 short getShort()
           
 boolean isByte()
           
 boolean isDouble()
           
 boolean isFloat()
           
 boolean isInt()
           
 boolean isLong()
           
 boolean isShort()
           
 jpel.language.ExpressionNumber mul(jpel.language.ExpressionNumber number)
           
 jpel.language.ExpressionNumber neg()
           
 jpel.language.ExpressionNumber rem(jpel.language.ExpressionNumber number)
           
 jpel.language.ExpressionNumber sub(jpel.language.ExpressionNumber number)
           
 java.lang.String toString()
           
 
Methods inherited from class jpel.language.ExpressionObject
equivalent, eval, freeVariable, rebuild
 
Methods inherited from class jpel.language.AbstractExpression
createClone, getData, getSource, getType, setData, setSource, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jpel.language.Expression
createClone, equivalent, eval, freeVariable, getData, getSource, getType, rebuild, setData, setSource, setType
 

Field Detail

BYTE

public static final int BYTE
See Also:
Constant Field Values

SHORT

public static final int SHORT
See Also:
Constant Field Values

INT

public static final int INT
See Also:
Constant Field Values

LONG

public static final int LONG
See Also:
Constant Field Values

FLOAT

public static final int FLOAT
See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
See Also:
Constant Field Values

MIN_BYTE

public static final jpel.language.ExpressionNumber MIN_BYTE

MAX_BYTE

public static final jpel.language.ExpressionNumber MAX_BYTE

MIN_SHORT

public static final jpel.language.ExpressionNumber MIN_SHORT

MAX_SHORT

public static final jpel.language.ExpressionNumber MAX_SHORT

MIN_INT

public static final jpel.language.ExpressionNumber MIN_INT

MAX_INT

public static final jpel.language.ExpressionNumber MAX_INT

MIN_LONG

public static final jpel.language.ExpressionNumber MIN_LONG

MAX_LONG

public static final jpel.language.ExpressionNumber MAX_LONG

MIN_FLOAT

public static final jpel.language.ExpressionNumber MIN_FLOAT

MAX_FLOAT

public static final jpel.language.ExpressionNumber MAX_FLOAT

MIN_DOUBLE

public static final jpel.language.ExpressionNumber MIN_DOUBLE

MAX_DOUBLE

public static final jpel.language.ExpressionNumber MAX_DOUBLE
Constructor Detail

ExpressionNumber

public ExpressionNumber(byte value)

ExpressionNumber

public ExpressionNumber(java.lang.Byte value)

ExpressionNumber

public ExpressionNumber(short value)

ExpressionNumber

public ExpressionNumber(java.lang.Short value)

ExpressionNumber

public ExpressionNumber(int value)

ExpressionNumber

public ExpressionNumber(java.lang.Integer value)

ExpressionNumber

public ExpressionNumber(long value)

ExpressionNumber

public ExpressionNumber(java.lang.Long value)

ExpressionNumber

public ExpressionNumber(float value)

ExpressionNumber

public ExpressionNumber(java.lang.Float value)

ExpressionNumber

public ExpressionNumber(double value)

ExpressionNumber

public ExpressionNumber(java.lang.Double value)

ExpressionNumber

public ExpressionNumber(java.lang.String value)
Method Detail

getData

public java.lang.Object getData(java.lang.Class type)
Description copied from interface: Expression
Retorna o dado associado à expressão.

Specified by:
getData in interface Expression
Overrides:
getData in class AbstractExpression
Parameters:
type - O tipo do objeto desejado.
Returns:
O objeto embutido dentro de uma expressão se ele for do tipo solicitado, null, caso contrário.

isByte

public boolean isByte()

canBeByte

public boolean canBeByte()

getByte

public byte getByte()

isShort

public boolean isShort()

canBeShort

public boolean canBeShort()

getShort

public short getShort()

isInt

public boolean isInt()

canBeInt

public boolean canBeInt()

getInt

public int getInt()

isLong

public boolean isLong()

canBeLong

public boolean canBeLong()

getLong

public long getLong()

isFloat

public boolean isFloat()

canBeFloat

public boolean canBeFloat()

getFloat

public float getFloat()

isDouble

public boolean isDouble()

canBeDouble

public boolean canBeDouble()

getDouble

public double getDouble()

bestMatch

public int bestMatch(jpel.language.ExpressionNumber number)

asString

public java.lang.String asString()
Description copied from interface: StringableExpression
Fornece uma representação em String da expressão.

Specified by:
asString in interface StringableExpression
Returns:
A String correspondente.

compareTo

public int compareTo(jpel.language.ComparableExpression expression)
              throws BadTypedException
Description copied from interface: ComparableExpression
Indicates a order relation throught instances of the same type.

Specified by:
compareTo in interface ComparableExpression
Returns:
-1 if it comes before then the give expression, 0 if is in the same leve, and 1 otherwise.
Throws:
BadTypedException - When a wrong comparation type is passed.

toString

public java.lang.String toString()
Overrides:
toString in class AbstractExpression

add

public jpel.language.ExpressionNumber add(jpel.language.ExpressionNumber number)

sub

public jpel.language.ExpressionNumber sub(jpel.language.ExpressionNumber number)

mul

public jpel.language.ExpressionNumber mul(jpel.language.ExpressionNumber number)

div

public jpel.language.ExpressionNumber div(jpel.language.ExpressionNumber number)

rem

public jpel.language.ExpressionNumber rem(jpel.language.ExpressionNumber number)

neg

public jpel.language.ExpressionNumber neg()