public final class NodeValue extends Node
NodeValue
class represents a node that stores a constant value.
The class serves as an adapter to allow Data to be used in an expression.Constructor and Description |
---|
NodeValue(Data data)
Creates a value syntax element based on a data object.
|
Modifier and Type | Method and Description |
---|---|
Node |
deepCopy()
Creates a deep copy of the current objects.
|
boolean |
equals(java.lang.Object obj) |
BitVector |
getBitVector()
Returns stored
BitVector value and throws an exception if the stored value
has a different type. |
boolean |
getBoolean()
Returns stored boolean value and throws an exception if the stored value has a different type.
|
Data |
getData()
Returns the data object that encapsulates the value.
|
DataType |
getDataType()
Returns an object that describes the type of the value referred by the node.
|
java.math.BigInteger |
getInteger()
Returns stored
BigInteger value and throws an exception if the stored value
has a different type. |
DataMap |
getMap()
Returns stored DataMap value and throws an exception if the stored value has a different type.
|
double |
getReal()
Returns stored Double value and throws an exception if the stored value has a different type.
|
java.lang.String |
getString()
Returns stored String value and throws an exception if the stored value has a different type.
|
java.lang.Object |
getValue()
Returns an object that stores a data value.
|
int |
hashCode() |
static NodeValue |
newBitVector(java.math.BigInteger value,
int size)
Creates a new value node based on a bit vector of the specified size constructed
from the specified
BigInteger value. |
static NodeValue |
newBitVector(BitVector value)
Creates a new value node based on a bit vector.
|
static NodeValue |
newBitVector(boolean value)
Creates a new value node based on a bit vector constructed from the specified boolean value.
|
static NodeValue |
newBitVector(int value,
int size)
Creates a new value node based on a bit vector of the specified size constructed
from the specified integer value.
|
static NodeValue |
newBitVector(long value,
int size)
Creates a new value node based on a bit vector of the specified size constructed
from the specified long value.
|
static NodeValue |
newBitVector(java.lang.String text,
int radix,
int size)
Creates a new value node based on a bit vector of the specified size constructed from
a textual representation.
|
static NodeValue |
newBoolean(boolean value)
Creates a new value node based on a boolean value.
|
static NodeValue |
newInteger(java.math.BigInteger value)
Creates a new value node based on a
BigInteger value. |
static NodeValue |
newInteger(int value)
Creates a new value node based on an integer value.
|
static NodeValue |
newInteger(java.lang.String text,
int radix)
Creates a new value node based on a textual representation of an integer value.
|
static NodeValue |
newMap(DataMap value)
Creates a new value node of the MAP type from the specified
DataMap object. |
static NodeValue |
newReal(double value)
Creates a new value node based on a double value.
|
static NodeValue |
newString(java.lang.String value)
Creates a new value node based on a String value.
|
static NodeValue |
newUnknown(java.lang.Object value)
Creates a new value node based on a value of an unknown type.
|
void |
setData(Data data)
Changes the data value associated with the node.
|
java.lang.String |
toString() |
deepestCopy, getDataTypeId, getKind, getUserData, isType, isType, isType, isType, setUserData
public NodeValue(Data data)
data
- A data object.java.lang.IllegalArgumentException
- if the argument is null
.public static NodeValue newInteger(int value)
value
- Integer value.public static NodeValue newInteger(java.math.BigInteger value)
BigInteger
value.value
- BigInteger
value.java.lang.IllegalArgumentException
- if the parameter equals null
.public static NodeValue newInteger(java.lang.String text, int radix)
text
- String to be parsed.radix
- Radix to be used to parsing.java.lang.IllegalArgumentException
- if the text
parameter equals null
.java.lang.NumberFormatException
- if failed to parse the string.public static NodeValue newReal(double value)
value
- Double value.public static NodeValue newString(java.lang.String value)
value
- String value.java.lang.IllegalArgumentException
- if the parameter equals null
.public static NodeValue newBoolean(boolean value)
value
- Boolean value.public static NodeValue newUnknown(java.lang.Object value)
value
- Value of an unknown type.public static NodeValue newBitVector(BitVector value)
value
- BitVector
value.java.lang.IllegalArgumentException
- if the value
parameter equals null
.public static NodeValue newBitVector(java.lang.String text, int radix, int size)
text
- Textual representation of the bit vector.radix
- Radix to be used for text parsing.size
- Size of the resulting bit vector in bits.java.lang.IllegalArgumentException
- if the s
argument is null
;
if the size
argument is zero or negative.public static NodeValue newBitVector(int value, int size)
value
- An integer value that represents binary data of the bit vector.size
- The bit vector size (in bits).java.lang.IllegalArgumentException
- if the size
argument is zero or negative.public static NodeValue newBitVector(long value, int size)
value
- An long value that represents binary data of the bit vector.size
- The bit vector size (in bits).java.lang.IllegalArgumentException
- if the size
argument is zero or negative.public static NodeValue newBitVector(java.math.BigInteger value, int size)
BigInteger
value.value
- A BigInteger
object that stores binary data for a bit vector.size
- The bit vector size (in bits).java.lang.IllegalArgumentException
- if the value
argument equals null
.public static NodeValue newBitVector(boolean value)
value
- Boolean value to be converted to a bit vector.public static NodeValue newMap(DataMap value)
DataMap
object.value
- A DataMap
object.java.lang.IllegalArgumentException
- if the map
parameter equals null
.public Node deepCopy()
Node
public Data getData()
public void setData(Data data)
data
- New data value to be associated with the node.java.lang.IllegalArgumentException
- if the argument is null
.public java.lang.Object getValue()
public DataType getDataType()
Node
getDataType
in class Node
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.math.BigInteger getInteger()
BigInteger
value and throws an exception if the stored value
has a different type.BigInteger
.java.lang.IllegalStateException
- if the stored data is not convertible to BigInteger
.public BitVector getBitVector()
BitVector
value and throws an exception if the stored value
has a different type.public boolean getBoolean()
java.lang.IllegalStateException
- if the stored data is not convertible to Boolean
.public double getReal()
java.lang.IllegalStateException
- if the stored data is not convertible to Double
.public java.lang.String getString()
java.lang.IllegalStateException
- if the stored data is not convertible to String
.