de.infinityloop.upcast.upl.val
Class UPLValue

java.lang.Object
  extended by de.infinityloop.upcast.upl.val.UPLValue
Direct Known Subclasses:
UPLBool, UPLColor, UPLId, UPLList, UPLNull, UPLNumeric, UPLString

public abstract class UPLValue
extends java.lang.Object


Field Summary
protected  boolean isBreakValue
           
protected  boolean isEmptyReturnValue
           
protected  boolean isReturnValue
          marks if a value calculated in a method/function terminates the method/function, effectively forcing a return from it
protected  boolean isValid
          marks if the value is valid (normally true, false if a value exists but is nor really set (used in case of variables/parameters))
static int kTYPE_BOOL
           
static int kTYPE_COLOR
           
static int kTYPE_ID
           
static int kTYPE_LIST
           
static int kTYPE_NULL
           
static int kTYPE_NUMERIC
           
static int kTYPE_STRING
           
static int kTYPE_UNKNOWN
           
static int kTYPE_VALUE
           
static int kTYPE_VOID
           
protected  int type
          the type of the Value
 
Constructor Summary
UPLValue()
           
 
Method Summary
 UPLValue add(UPLValue v)
           
 UPLValue affirmate()
          Affirmates (unary +) a UPLValue.
static UPLValue castValueToType(de.infinityloop.upcast.util.namespace.NamespaceManager nsm, int targetType, UPLValue value)
          Performs a cast of the passed value to the specified type
abstract  int compareTo(int compareType, UPLValue to)
           
 UPLValue decrement()
          unary decrement.
 UPLValue div(UPLValue v)
           
 boolean equals(UPLValue to)
           
 UPLValue eval(de.infinityloop.upcast.upl.util.Context context)
           
abstract  java.lang.String getAsString()
           
abstract  java.lang.String getAsUPL()
           
abstract  boolean getBooleanValue()
          The boolean value of an UPLValue.
abstract  java.lang.String getDebugString()
           
 int getType()
           
static int getType(java.lang.String name)
           
 java.lang.String getTypeName()
           
static java.lang.String getTypeName(int i)
           
 UPLValue increment()
          unary increment.
 boolean isBreakValue()
           
 boolean isEmptyReturnValue()
           
 boolean isReturnValue()
           
 boolean isValid()
           
 UPLValue mod(UPLValue v)
           
 UPLValue negate()
          Negates (unary minus) a UPLValue.
 UPLValue not()
           
 void setBreakValue(boolean isBreakValue)
           
 void setEmptyReturnValue(boolean isEmptyReturnValue)
           
 void setReturnValue(boolean isReturnValue)
          sets whether this value if calculated in a method/function terminates the method/function, effectively forcing a return from it
 void setValid(boolean isValid)
           
 UPLValue sub(UPLValue v)
           
 UPLValue times(UPLValue v)
           
 java.lang.String toString()
          used for debugging purposes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kTYPE_VOID

public static final int kTYPE_VOID
See Also:
Constant Field Values

kTYPE_UNKNOWN

public static final int kTYPE_UNKNOWN
See Also:
Constant Field Values

kTYPE_VALUE

public static final int kTYPE_VALUE
See Also:
Constant Field Values

kTYPE_NULL

public static final int kTYPE_NULL
See Also:
Constant Field Values

kTYPE_ID

public static final int kTYPE_ID
See Also:
Constant Field Values

kTYPE_STRING

public static final int kTYPE_STRING
See Also:
Constant Field Values

kTYPE_NUMERIC

public static final int kTYPE_NUMERIC
See Also:
Constant Field Values

kTYPE_BOOL

public static final int kTYPE_BOOL
See Also:
Constant Field Values

kTYPE_COLOR

public static final int kTYPE_COLOR
See Also:
Constant Field Values

kTYPE_LIST

public static final int kTYPE_LIST
See Also:
Constant Field Values

type

protected int type
the type of the Value


isValid

protected boolean isValid
marks if the value is valid (normally true, false if a value exists but is nor really set (used in case of variables/parameters))


isReturnValue

protected boolean isReturnValue
marks if a value calculated in a method/function terminates the method/function, effectively forcing a return from it


isEmptyReturnValue

protected boolean isEmptyReturnValue

isBreakValue

protected boolean isBreakValue
Constructor Detail

UPLValue

public UPLValue()
Method Detail

eval

public UPLValue eval(de.infinityloop.upcast.upl.util.Context context)
              throws UPLValueException
Throws:
UPLValueException

not

public final UPLValue not()
                   throws UPLValueException
Throws:
UPLValueException

equals

public final boolean equals(UPLValue to)
                     throws UPLValueException
Throws:
UPLValueException

compareTo

public abstract int compareTo(int compareType,
                              UPLValue to)
                       throws UPLValueException
Throws:
UPLValueException

affirmate

public UPLValue affirmate()
                   throws UPLValueException
Affirmates (unary +) a UPLValue.

Throws:
UPLValueException

negate

public UPLValue negate()
                throws UPLValueException
Negates (unary minus) a UPLValue.

Returns:
the negated value
Throws:
UPLValueException

increment

public UPLValue increment()
                   throws UPLValueException
unary increment.

Returns:
Throws:
UPLValueException

decrement

public UPLValue decrement()
                   throws UPLValueException
unary decrement.

Returns:
Throws:
UPLValueException

getBooleanValue

public abstract boolean getBooleanValue()
                                 throws UPLValueException
The boolean value of an UPLValue.

Returns:
the boolean value of an UPLValue.
Throws:
UPLValueException

add

public UPLValue add(UPLValue v)
             throws UPLValueException
Throws:
UPLValueException

sub

public UPLValue sub(UPLValue v)
             throws UPLValueException
Throws:
UPLValueException

times

public UPLValue times(UPLValue v)
               throws UPLValueException
Throws:
UPLValueException

div

public UPLValue div(UPLValue v)
             throws UPLValueException
Throws:
UPLValueException

mod

public UPLValue mod(UPLValue v)
             throws UPLValueException
Throws:
UPLValueException

getAsString

public abstract java.lang.String getAsString()

getAsUPL

public abstract java.lang.String getAsUPL()

toString

public final java.lang.String toString()
used for debugging purposes

Overrides:
toString in class java.lang.Object
Returns:
See Also:
Object.toString()

getDebugString

public abstract java.lang.String getDebugString()

getType

public int getType()

getTypeName

public java.lang.String getTypeName()

getTypeName

public static java.lang.String getTypeName(int i)

getType

public static int getType(java.lang.String name)

isReturnValue

public boolean isReturnValue()
Returns:
true if this value if calculated in a method/function terminates the method/function, effectively forcing a return from it

setReturnValue

public void setReturnValue(boolean isReturnValue)
sets whether this value if calculated in a method/function terminates the method/function, effectively forcing a return from it

Parameters:
isReturnValue -

isEmptyReturnValue

public boolean isEmptyReturnValue()

setEmptyReturnValue

public void setEmptyReturnValue(boolean isEmptyReturnValue)

isBreakValue

public boolean isBreakValue()

setBreakValue

public void setBreakValue(boolean isBreakValue)

isValid

public boolean isValid()

setValid

public void setValid(boolean isValid)

castValueToType

public static UPLValue castValueToType(de.infinityloop.upcast.util.namespace.NamespaceManager nsm,
                                       int targetType,
                                       UPLValue value)
                                throws UPLValueException
Performs a cast of the passed value to the specified type

Parameters:
targetType - the type to convert to
value -
Returns:
Throws:
UPLValueException