public class AbsPrimitive extends Object implements AbsTerm
Modifier and Type | Field and Description |
---|---|
private String |
typeName |
private Object |
value |
ABS_AGENT_ACTION, ABS_AGGREGATE, ABS_CONCEPT, ABS_CONCEPT_SLOT_FUNCTION, ABS_CONTENT_ELEMENT_LIST, ABS_IRE, ABS_PREDICATE, ABS_PRIMITIVE, ABS_VARIABLE, UNKNOWN
Modifier | Constructor and Description |
---|---|
|
AbsPrimitive(String typeName)
Construct an Abstract descriptor to hold a primitive of
the proper type (e.g.
|
private |
AbsPrimitive(String typeName,
Object value)
Construct an Abstract descriptor to hold a primitive of
the proper type (e.g.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
AbsObject |
getAbsObject(String name)
Makes no sense in the case of an AbsPrimitive that has no attribute
--> Just return null
|
int |
getAbsType() |
boolean |
getBoolean() |
byte[] |
getByteSequence() |
int |
getCount()
Makes no sense in the case of an AbsPrimitive that has no attribute
--> Just return 0
|
Date |
getDate() |
double |
getDouble() |
float |
getFloat() |
int |
getInteger() |
long |
getLong() |
String[] |
getNames()
Makes no sense in the case of an AbsPrimitive that has no attribute
--> Just return null
|
Object |
getObject() |
String |
getString() |
String |
getTypeName() |
int |
hashCode() |
boolean |
isGrounded()
Tests if this AbsPrimitive is grounded.
|
void |
set(boolean value)
Set the value of this AbsPrimitive to the given boolean value.
|
void |
set(byte[] value)
Set the value of this AbsPrimitive to the given byte[] value.
|
void |
set(Date value)
Set the value of this AbsPrimitive to the given Date value.
|
void |
set(double value)
Set the value of this AbsPrimitive to the given double value.
|
void |
set(float value)
Set the value of this AbsPrimitive to the given float value.
|
void |
set(int value)
Set the value of this AbsPrimitive to the given int value.
|
void |
set(long value)
Set the value of this AbsPrimitive to the given long value.
|
void |
set(String value)
Set the value of this AbsPrimitive to the given String.
|
String |
toString() |
static AbsPrimitive |
wrap(boolean value)
Create an AbsPrimitive of type
BasicOntology.BOOLEAN
containing a given boolean value. |
static AbsPrimitive |
wrap(byte[] value)
Create an AbsPrimitive of type
BasicOntology.BYTE_SEQUENCE
containing a given byte[] value. |
static AbsPrimitive |
wrap(Date value)
Create an AbsPrimitive of type
BasicOntology.DATE
containing a given Date value. |
static AbsPrimitive |
wrap(double value)
Create an AbsPrimitive of type
BasicOntology.FLOAT
containing a given double value. |
static AbsPrimitive |
wrap(float value)
Create an AbsPrimitive of type
BasicOntology.FLOAT
containing a given float value. |
static AbsPrimitive |
wrap(int value)
Create an AbsPrimitive of type
BasicOntology.INTEGER
containing a given int value. |
static AbsPrimitive |
wrap(long value)
Create an AbsPrimitive of type
BasicOntology.INTEGER
containing a given long value. |
static AbsPrimitive |
wrap(String value)
Create an AbsPrimitive of type
BasicOntology.STRING
containing a given String value. |
private AbsPrimitive(String typeName, Object value)
public AbsPrimitive(String typeName)
typeName
- The name of the type of the primitive held by
this abstract descriptor.public static AbsPrimitive wrap(String value)
BasicOntology.STRING
containing a given String
value.public static AbsPrimitive wrap(boolean value)
BasicOntology.BOOLEAN
containing a given boolean
value.public static AbsPrimitive wrap(int value)
BasicOntology.INTEGER
containing a given int
value.public static AbsPrimitive wrap(long value)
BasicOntology.INTEGER
containing a given long
value.public static AbsPrimitive wrap(float value)
BasicOntology.FLOAT
containing a given float
value.public static AbsPrimitive wrap(double value)
BasicOntology.FLOAT
containing a given double
value.public static AbsPrimitive wrap(Date value)
BasicOntology.DATE
containing a given Date
value.public static AbsPrimitive wrap(byte[] value)
BasicOntology.BYTE_SEQUENCE
containing a given byte[]
value.public void set(String value)
value
- The new valueIllegalArgumentException
- If the type of this AbsPrimitive
is not BasicOntology.STRING
public void set(boolean value)
value
- The new valueIllegalArgumentException
- If the type of this AbsPrimitive
is not BasicOntology.BOOLEAN
public void set(int value)
value
- The new valueIllegalArgumentException
- If the type of this AbsPrimitive
is not BasicOntology.INTEGER
public void set(long value)
value
- The new valueIllegalArgumentException
- If the type of this AbsPrimitive
is not BasicOntology.INTEGER
public void set(float value)
value
- The new valueIllegalArgumentException
- If the type of this AbsPrimitive
is not BasicOntology.FLOAT
public void set(double value)
value
- The new valueIllegalArgumentException
- If the type of this AbsPrimitive
is not BasicOntology.FLOAT
public void set(Date value)
value
- The new valueIllegalArgumentException
- If the type of this AbsPrimitive
is not BasicOntology.DATE
public void set(byte[] value)
value
- The new valueIllegalArgumentException
- If the type of this AbsPrimitive
is not BasicOntology.BYTE_SEQUENCE
public String getString()
ClassCastException
- If the type of this AbsPrimitive
is not BasicOntology.STRING
public boolean getBoolean()
ClassCastException
- If the type of this AbsPrimitive
is not BasicOntology.BOOLEAN
public int getInteger()
ClassCastException
- If the type of this AbsPrimitive
is not BasicOntology.INTEGER
public long getLong()
ClassCastException
- If the type of this AbsPrimitive
is not BasicOntology.INTEGER
public float getFloat()
ClassCastException
- If the type of this AbsPrimitive
is not BasicOntology.FLOAT
public double getDouble()
ClassCastException
- If the type of this AbsPrimitive
is not BasicOntology.FLOAT
public Date getDate()
ClassCastException
- If the type of this AbsPrimitive
is not BasicOntology.DATE
public byte[] getByteSequence()
ClassCastException
- If the type of this AbsPrimitive
is not BasicOntology.BYTE_SEQUENCE
public Object getObject()
BasicOntology.BOOLEAN
BasicOntology.INTEGER or BasicOntology.FLOAT
a
Boolean, Integer or Float
object is returned.public String getTypeName()
getTypeName
in interface AbsObject
AbsObject.getTypeName()
public AbsObject getAbsObject(String name)
getAbsObject
in interface AbsObject
name
- The name of the attribute.public String[] getNames()
public boolean isGrounded()
isGrounded
in interface AbsObject
true
if the object is grounded.public int getCount()
public int getAbsType()
getAbsType
in interface AbsObject