public final class Data
extends java.lang.Object
Constructor and Description |
---|
Data(DataType type,
java.lang.Object value)
Constructs a data object of the specified type and initializes its value with the specified
value object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
DataMap |
getArray()
Returns a DataMap value stored in the data object.
|
BitVector |
getBitVector()
Returns a BitVector value stored in the data object.
|
boolean |
getBoolean()
Returns a boolean value stored in the data object.
|
java.math.BigInteger |
getInteger()
Returns a BigInteger value stored in the data object.
|
double |
getReal()
Returns a Double value stored in the data object.
|
DataType |
getType()
Returns information about the type of the stored value.
|
java.lang.Object |
getUserData()
Returns the value of the used-defined property.
|
java.lang.Object |
getValue()
Returns an object that holds the data.
|
<T> T |
getValue(java.lang.Class<T> c)
Returns an object of given type that holds the data.
|
int |
hashCode() |
boolean |
hasValue()
Checks whether a value assigned to the the data object.
|
boolean |
isType(DataType type)
Checks whether the stored value has the specified type
(comparison is based on
DataType ). |
boolean |
isType(DataTypeId typeId)
Checks whether the stored value has the specified type
(comparison is based on
DataTypeId ). |
static Data |
newArray(DataMap map)
Creates a data object of the MAP type from the specified
DataMap object. |
static Data |
newBitVector(java.math.BigInteger value,
int size)
Creates a data object of the BIT_VECTOR type from a BigInteger object.
|
static Data |
newBitVector(BitVector value)
Creates a data object of the BIT_VECTOR type from a BitVector object.
|
static Data |
newBitVector(int value,
int size)
Creates a data object of the BIT_VECTOR type from an integer value.
|
static Data |
newBitVector(long value,
int size)
Creates a data object of the BIT_VECTOR type from a long integer value.
|
static Data |
newBitVector(java.lang.String s,
int radix,
int size)
Creates a data object of the BIT_VECTOR type from a string.
|
static Data |
newBoolean(boolean value)
Creates a data object of the BOOLEAN type from a boolean value.
|
static Data |
newInteger(java.math.BigInteger value)
Creates a data object of the INTEGER type from a BigInteger value.
|
static Data |
newInteger(int value)
Creates a data object of the INTEGER type from an integer value.
|
static Data |
newInteger(long value)
Creates a data object of the INTEGER type from a long value.
|
static Data |
newInteger(java.lang.String text,
int radix)
Creates a data object of the INTEGER type from a string.
|
static Data |
newReal(double value)
Creates a data object of the REAL type from an double value.
|
static Data |
newUnknown(java.lang.Object value)
Creates a data object from an object value of an unknown type (UNKNOWN will be used as target
type).
|
void |
setUserData(java.lang.Object obj)
Assigns value to the user-defined property.
|
java.lang.String |
toString() |
public Data(DataType type, java.lang.Object value)
type
- The type of the data.value
- An object of related type that stores the data.public static Data newInteger(java.math.BigInteger value)
value
- A BitInteger value.java.lang.NullPointerException
- if the parameter equals null
.public static Data newInteger(long value)
value
- A long value.public static Data newInteger(int value)
value
- An integer value.public static Data newInteger(java.lang.String text, int radix)
text
- String to be parsed.radix
- Radix to be used for parsing.java.lang.NullPointerException
- if the text
parameter equals null
.java.lang.NumberFormatException
- if failed to parse the string.public static Data newReal(double value)
value
- A double value.public static Data newBoolean(boolean value)
value
- A boolean value.public static Data newUnknown(java.lang.Object value)
value
- A value of an unknown type.public static Data newBitVector(java.math.BigInteger value, int size)
value
- A BigInteger object that stores binary data for a bit vector.size
- The bit vector size (in bits).java.lang.NullPointerException
- if the value
parameter equals null
.public static Data newBitVector(BitVector value)
value
- A BitVector object.java.lang.NullPointerException
- if the value
parameter equals null
.public static Data newBitVector(java.lang.String s, int radix, int size)
s
- Textual representation of the bit vector.radix
- Radix to be used for parsing.size
- Size of the resulting bit vector in bits.java.lang.NullPointerException
- if the s
parameter equals null
.public static Data newBitVector(int value, int size)
value
- Integer value to be converted.size
- The bit vector size (in bits).public static Data newBitVector(long value, int size)
value
- Long integer value to be converted.size
- The bit vector size (in bits).public static Data newArray(DataMap map)
DataMap
object.map
- A DataMap
object.java.lang.NullPointerException
- if the map
parameter equals null
.public DataType getType()
public boolean hasValue()
public java.lang.Object getValue()
public <T> T getValue(java.lang.Class<T> c)
c
- A type of value object.public java.lang.Object getUserData()
public void setUserData(java.lang.Object obj)
obj
- User-defined object.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 boolean isType(DataTypeId typeId)
DataTypeId
).typeId
- DataTypeId
object the data type is to be compared to.true
if the type matches the type specified by the typeId
argument or false
otherwise.public boolean isType(DataType type)
DataType
).type
- DataType
object the data type is to be compared to.true
if the type matches the type specified by the type
argument or false
otherwise.public java.math.BigInteger getInteger()
DataTypeId.LOGIC_INTEGER
.java.lang.IllegalStateException
- if the stored data is not convertible to BigInteger
.public BitVector getBitVector()
DataTypeId.BIT_VECTOR
.public boolean getBoolean()
DataTypeId.LOGIC_BOOLEAN
.java.lang.IllegalStateException
- if the stored data is not convertible to Boolean
.public double getReal()
DataTypeId.LOGIC_REAL
.java.lang.IllegalStateException
- if the stored data is not convertible to Double
.public DataMap getArray()
DataTypeId.MAP
.DataMap
.java.lang.IllegalStateException
- if the stored data is not convertible to DataMap
.