Package jade.content.abs
Class AbsPrimitive
- java.lang.Object
-
- jade.content.abs.AbsPrimitive
-
- All Implemented Interfaces:
AbsObject,AbsTerm,Term,Serializable,Serializable
public class AbsPrimitive extends Object implements AbsTerm
An abstract descriptor that can hold a primitive expression.- Author:
- Paola Turci, Federico Bergenti - Universita` di Parma, Giovanni Caire - TILAB
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface jade.content.abs.AbsObject
ABS_AGENT_ACTION, ABS_AGGREGATE, ABS_CONCEPT, ABS_CONCEPT_SLOT_FUNCTION, ABS_CONTENT_ELEMENT_LIST, ABS_IRE, ABS_PREDICATE, ABS_PRIMITIVE, ABS_REFERENCE, ABS_VARIABLE, UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description AbsPrimitive(String typeName)Construct an Abstract descriptor to hold a primitive of the proper type (e.g.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)AbsObjectgetAbsObject(String name)Makes no sense in the case of an AbsPrimitive that has no attribute --> Just return nullintgetAbsType()booleangetBoolean()byte[]getByteSequence()intgetCount()Makes no sense in the case of an AbsPrimitive that has no attribute --> Just return 0DategetDate()doublegetDouble()floatgetFloat()intgetInteger()longgetLong()String[]getNames()Makes no sense in the case of an AbsPrimitive that has no attribute --> Just return nullObjectgetObject()StringgetString()StringgetTypeName()inthashCode()booleanisGrounded()Tests if this AbsPrimitive is grounded.voidset(boolean value)Set the value of this AbsPrimitive to the given boolean value.voidset(byte[] value)Set the value of this AbsPrimitive to the given byte[] value.voidset(double value)Set the value of this AbsPrimitive to the given double value.voidset(float value)Set the value of this AbsPrimitive to the given float value.voidset(int value)Set the value of this AbsPrimitive to the given int value.voidset(long value)Set the value of this AbsPrimitive to the given long value.voidset(String value)Set the value of this AbsPrimitive to the given String.voidset(Date value)Set the value of this AbsPrimitive to the given Date value.StringtoString()static AbsPrimitivewrap(boolean value)Create an AbsPrimitive of typeBasicOntology.BOOLEANcontaining a givenbooleanvalue.static AbsPrimitivewrap(byte[] value)Create an AbsPrimitive of typeBasicOntology.BYTE_SEQUENCEcontaining a givenbyte[]value.static AbsPrimitivewrap(double value)Create an AbsPrimitive of typeBasicOntology.FLOATcontaining a givendoublevalue.static AbsPrimitivewrap(float value)Create an AbsPrimitive of typeBasicOntology.FLOATcontaining a givenfloatvalue.static AbsPrimitivewrap(int value)Create an AbsPrimitive of typeBasicOntology.INTEGERcontaining a givenintvalue.static AbsPrimitivewrap(long value)Create an AbsPrimitive of typeBasicOntology.INTEGERcontaining a givenlongvalue.static AbsPrimitivewrap(String value)Create an AbsPrimitive of typeBasicOntology.STRINGcontaining a givenStringvalue.static AbsPrimitivewrap(Date value)Create an AbsPrimitive of typeBasicOntology.DATEcontaining a givenDatevalue.
-
-
-
Constructor Detail
-
AbsPrimitive
public AbsPrimitive(String typeName)
Construct an Abstract descriptor to hold a primitive of the proper type (e.g. String, int, boolean...).- Parameters:
typeName- The name of the type of the primitive held by this abstract descriptor.
-
-
Method Detail
-
wrap
public static AbsPrimitive wrap(String value)
Create an AbsPrimitive of typeBasicOntology.STRINGcontaining a givenStringvalue.
-
wrap
public static AbsPrimitive wrap(boolean value)
Create an AbsPrimitive of typeBasicOntology.BOOLEANcontaining a givenbooleanvalue.
-
wrap
public static AbsPrimitive wrap(int value)
Create an AbsPrimitive of typeBasicOntology.INTEGERcontaining a givenintvalue.
-
wrap
public static AbsPrimitive wrap(long value)
Create an AbsPrimitive of typeBasicOntology.INTEGERcontaining a givenlongvalue.
-
wrap
public static AbsPrimitive wrap(float value)
Create an AbsPrimitive of typeBasicOntology.FLOATcontaining a givenfloatvalue.
-
wrap
public static AbsPrimitive wrap(double value)
Create an AbsPrimitive of typeBasicOntology.FLOATcontaining a givendoublevalue.
-
wrap
public static AbsPrimitive wrap(Date value)
Create an AbsPrimitive of typeBasicOntology.DATEcontaining a givenDatevalue.
-
wrap
public static AbsPrimitive wrap(byte[] value)
Create an AbsPrimitive of typeBasicOntology.BYTE_SEQUENCEcontaining a givenbyte[]value.
-
set
public void set(String value)
Set the value of this AbsPrimitive to the given String.- Parameters:
value- The new value- Throws:
IllegalArgumentException- If the type of this AbsPrimitive is notBasicOntology.STRING
-
set
public void set(boolean value)
Set the value of this AbsPrimitive to the given boolean value.- Parameters:
value- The new value- Throws:
IllegalArgumentException- If the type of this AbsPrimitive is notBasicOntology.BOOLEAN
-
set
public void set(int value)
Set the value of this AbsPrimitive to the given int value.- Parameters:
value- The new value- Throws:
IllegalArgumentException- If the type of this AbsPrimitive is notBasicOntology.INTEGER
-
set
public void set(long value)
Set the value of this AbsPrimitive to the given long value.- Parameters:
value- The new value- Throws:
IllegalArgumentException- If the type of this AbsPrimitive is notBasicOntology.INTEGER
-
set
public void set(float value)
Set the value of this AbsPrimitive to the given float value.- Parameters:
value- The new value- Throws:
IllegalArgumentException- If the type of this AbsPrimitive is notBasicOntology.FLOAT
-
set
public void set(double value)
Set the value of this AbsPrimitive to the given double value.- Parameters:
value- The new value- Throws:
IllegalArgumentException- If the type of this AbsPrimitive is notBasicOntology.FLOAT
-
set
public void set(Date value)
Set the value of this AbsPrimitive to the given Date value.- Parameters:
value- The new value- Throws:
IllegalArgumentException- If the type of this AbsPrimitive is notBasicOntology.DATE
-
set
public void set(byte[] value)
Set the value of this AbsPrimitive to the given byte[] value.- Parameters:
value- The new value- Throws:
IllegalArgumentException- If the type of this AbsPrimitive is notBasicOntology.BYTE_SEQUENCE
-
getString
public String getString()
- Returns:
- the value of this AbsPrimitive as a String.
- Throws:
ClassCastException- If the type of this AbsPrimitive is notBasicOntology.STRING
-
getBoolean
public boolean getBoolean()
- Returns:
- the value of this AbsPrimitive as a boolean.
- Throws:
ClassCastException- If the type of this AbsPrimitive is notBasicOntology.BOOLEAN
-
getInteger
public int getInteger()
- Returns:
- the value of this AbsPrimitive as an int.
- Throws:
ClassCastException- If the type of this AbsPrimitive is notBasicOntology.INTEGER
-
getLong
public long getLong()
- Returns:
- the value of this AbsPrimitive as a long.
- Throws:
ClassCastException- If the type of this AbsPrimitive is notBasicOntology.INTEGER
-
getFloat
public float getFloat()
- Returns:
- the value of this AbsPrimitive as a float.
- Throws:
ClassCastException- If the type of this AbsPrimitive is notBasicOntology.FLOAT
-
getDouble
public double getDouble()
- Returns:
- the value of this AbsPrimitive as a double.
- Throws:
ClassCastException- If the type of this AbsPrimitive is notBasicOntology.FLOAT
-
getDate
public Date getDate()
- Returns:
- the value of this AbsPrimitive as a Date.
- Throws:
ClassCastException- If the type of this AbsPrimitive is notBasicOntology.DATE
-
getByteSequence
public byte[] getByteSequence()
- Returns:
- the value of this AbsPrimitive as a byte[].
- Throws:
ClassCastException- If the type of this AbsPrimitive is notBasicOntology.BYTE_SEQUENCE
-
getObject
public Object getObject()
- Returns:
- the value of this AbsPrimitive as an Object.
If the type of this AbsPrimitive is
BasicOntology.BOOLEAN BasicOntology.INTEGER or BasicOntology.FLOATaBoolean, Integer or Floatobject is returned.
-
getTypeName
public String getTypeName()
- Specified by:
getTypeNamein interfaceAbsObject- Returns:
- The name of the type of the object held by this abstract descriptor.
- See Also:
AbsObject.getTypeName()
-
getAbsObject
public AbsObject getAbsObject(String name)
Makes no sense in the case of an AbsPrimitive that has no attribute --> Just return null- Specified by:
getAbsObjectin interfaceAbsObject- Parameters:
name- The name of the attribute.- Returns:
- value The value of the attribute.
-
getNames
public String[] getNames()
Makes no sense in the case of an AbsPrimitive that has no attribute --> Just return null
-
isGrounded
public boolean isGrounded()
Tests if this AbsPrimitive is grounded. It always returns true- Specified by:
isGroundedin interfaceAbsObject- Returns:
trueif the object is grounded.
-
getCount
public int getCount()
Makes no sense in the case of an AbsPrimitive that has no attribute --> Just return 0
-
getAbsType
public int getAbsType()
- Specified by:
getAbsTypein interfaceAbsObject
-
-