jade.content.abs
Class AbsPredicate

java.lang.Object
  |
  +--jade.content.abs.AbsObjectImpl
        |
        +--jade.content.abs.AbsPrimitiveSlotsHolder
              |
              +--jade.content.abs.AbsPredicate
All Implemented Interfaces:
AbsContentElement, AbsObject, ContentElement, Predicate, java.io.Serializable, Serializable

public class AbsPredicate
extends jade.content.abs.AbsPrimitiveSlotsHolder
implements AbsContentElement, Predicate

An abstract descriptor that can hold a predicate expression.

Author:
Paola Turci, Federico Bergenti - Universita` di Parma
See Also:
Serialized Form

Constructor Summary
AbsPredicate(java.lang.String typeName)
          Construct an Abstract descriptor to hold a predicate of the proper type (e.g.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the attribute is equal to this abstract descriptor, based on the contents of both descriptors.
 AbsObject getAbsObject(java.lang.String name)
          Gets the value of an attribute of the object held by this abstract descriptor.
 AbsTerm getAbsTerm(java.lang.String name)
          Gets the value (casted as an AbsTerm) of an attribute of the predicate held by this abstract descriptor.
 boolean getBoolean(java.lang.String name)
          Utility method that allows getting the value of attributes of type boolean directly as a boolean i.e.
 byte[] getByteSequence(java.lang.String name)
          Utility method that allows getting the value of attributes of type byte[] directly as a byte[] i.e.
 int getCount()
          Gets the number of attributes.
 java.util.Date getDate(java.lang.String name)
          Utility method that allows getting the value of attributes of type Date directly as a Date i.e.
 double getDouble(java.lang.String name)
          Utility method that allows getting the value of attributes of type double directly as a double i.e.
 float getFloat(java.lang.String name)
          Utility method that allows getting the value of attributes of type float directly as a float i.e.
 int getInteger(java.lang.String name)
          Utility method that allows getting the value of attributes of type int directly as an int i.e.
static java.lang.Class getJavaClass()
           
 long getLong(java.lang.String name)
          Utility method that allows getting the value of attributes of type long directly as a long i.e.
 java.lang.String[] getNames()
           
 java.lang.String getString(java.lang.String name)
          Utility method that allows getting the value of attributes of type String directly as a String i.e.
 java.lang.String getTypeName()
           
 int hashCode()
          Returns an integer hashcode calculated from the contents of this abstract descriptor
 boolean isGrounded()
          Tests if the object is grounded, i.e., if no one of its attributes is associated with a variable
 void set(java.lang.String name, AbsObject value)
          Sets an attribute of the predicate held by this abstract descriptor.
 void set(java.lang.String name, boolean value)
          Utility method that allows setting attributes of type boolean without the need of wrapping the new value into an AbsPrimitive.
 void set(java.lang.String name, byte[] value)
          Utility method that allows setting attributes of type byte[] without the need of wrapping the new value into an AbsPrimitive.
 void set(java.lang.String name, java.util.Date value)
          Utility method that allows setting attributes of type Date without the need of wrapping the new value into an AbsPrimitive.
 void set(java.lang.String name, double value)
          Utility method that allows setting attributes of type double without the need of wrapping the new value into an AbsPrimitive.
 void set(java.lang.String name, float value)
          Utility method that allows setting attributes of type float without the need of wrapping the new value into an AbsPrimitive.
 void set(java.lang.String name, int value)
          Utility method that allows setting attributes of type int without the need of wrapping the new value into an AbsPrimitive.
 void set(java.lang.String name, long value)
          Utility method that allows setting attributes of type long without the need of wrapping the new value into an AbsPrimitive.
 void set(java.lang.String name, java.lang.String value)
          Utility method that allows setting attributes of type String without the need of wrapping the new value into an AbsPrimitive.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jade.content.abs.AbsObject
getAbsObject, getCount, getNames, getTypeName, isGrounded
 

Constructor Detail

AbsPredicate

public AbsPredicate(java.lang.String typeName)
Construct an Abstract descriptor to hold a predicate of the proper type (e.g. FATHER_OF, WORKS_FOR...).

Parameters:
typeName - The name of the type of the predicate held by this abstract descriptor.
Method Detail

set

public void set(java.lang.String name,
                AbsObject value)
Sets an attribute of the predicate held by this abstract descriptor.

Overrides:
set in class jade.content.abs.AbsObjectImpl
Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.

getAbsTerm

public AbsTerm getAbsTerm(java.lang.String name)
Gets the value (casted as an AbsTerm) of an attribute of the predicate held by this abstract descriptor. This method is here mainly for backward compatibility.

Parameters:
name - The name of the attribute.
Returns:
value The value of the attribute.

getJavaClass

public static java.lang.Class getJavaClass()

set

public void set(java.lang.String name,
                java.lang.String value)
Utility method that allows setting attributes of type String without the need of wrapping the new value into an AbsPrimitive.

Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.

set

public void set(java.lang.String name,
                boolean value)
Utility method that allows setting attributes of type boolean without the need of wrapping the new value into an AbsPrimitive.

Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.

set

public void set(java.lang.String name,
                int value)
Utility method that allows setting attributes of type int without the need of wrapping the new value into an AbsPrimitive.

Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.

set

public void set(java.lang.String name,
                long value)
Utility method that allows setting attributes of type long without the need of wrapping the new value into an AbsPrimitive.

Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.

set

public void set(java.lang.String name,
                float value)
Utility method that allows setting attributes of type float without the need of wrapping the new value into an AbsPrimitive.

Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.

set

public void set(java.lang.String name,
                double value)
Utility method that allows setting attributes of type double without the need of wrapping the new value into an AbsPrimitive.

Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.

set

public void set(java.lang.String name,
                java.util.Date value)
Utility method that allows setting attributes of type Date without the need of wrapping the new value into an AbsPrimitive.

Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.

set

public void set(java.lang.String name,
                byte[] value)
Utility method that allows setting attributes of type byte[] without the need of wrapping the new value into an AbsPrimitive.

Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.

getString

public java.lang.String getString(java.lang.String name)
Utility method that allows getting the value of attributes of type String directly as a String i.e. not wrapped into an AbsPrimitive/code>.

Parameters:
name - The name of the attribute to be retrieved.

getBoolean

public boolean getBoolean(java.lang.String name)
Utility method that allows getting the value of attributes of type boolean directly as a boolean i.e. not wrapped into an AbsPrimitive/code>.

Parameters:
name - The name of the attribute to be retrieved.

getInteger

public int getInteger(java.lang.String name)
Utility method that allows getting the value of attributes of type int directly as an int i.e. not wrapped into an AbsPrimitive/code>.

Parameters:
name - The name of the attribute to be retrieved.

getLong

public long getLong(java.lang.String name)
Utility method that allows getting the value of attributes of type long directly as a long i.e. not wrapped into an AbsPrimitive/code>.

Parameters:
name - The name of the attribute to be retrieved.

getFloat

public float getFloat(java.lang.String name)
Utility method that allows getting the value of attributes of type float directly as a float i.e. not wrapped into an AbsPrimitive/code>.

Parameters:
name - The name of the attribute to be retrieved.

getDouble

public double getDouble(java.lang.String name)
Utility method that allows getting the value of attributes of type double directly as a double i.e. not wrapped into an AbsPrimitive/code>.

Parameters:
name - The name of the attribute to be retrieved.

getDate

public java.util.Date getDate(java.lang.String name)
Utility method that allows getting the value of attributes of type Date directly as a Date i.e. not wrapped into an AbsPrimitive/code>.

Parameters:
name - The name of the attribute to be retrieved.

getByteSequence

public byte[] getByteSequence(java.lang.String name)
Utility method that allows getting the value of attributes of type byte[] directly as a byte[] i.e. not wrapped into an AbsPrimitive/code>.

Parameters:
name - The name of the attribute to be retrieved.

getTypeName

public java.lang.String getTypeName()
Specified by:
getTypeName in interface AbsObject
Returns:
The name of the type of the object held by this abstract descriptor.
See Also:
AbsObject.getTypeName()

getAbsObject

public AbsObject getAbsObject(java.lang.String name)
Gets the value of an attribute of the object held by this abstract descriptor.

Specified by:
getAbsObject in interface AbsObject
Parameters:
name - The name of the attribute.
Returns:
value The value of the attribute.
See Also:
AbsObject.getAbsObject(String)

getNames

public java.lang.String[] getNames()
Specified by:
getNames in interface AbsObject
Returns:
the name of all attributes.
See Also:
AbsObject.getNames()

isGrounded

public boolean isGrounded()
Tests if the object is grounded, i.e., if no one of its attributes is associated with a variable

Specified by:
isGrounded in interface AbsObject
Returns:
true if the object is grounded.
See Also:
AbsObject.isGrounded()

getCount

public int getCount()
Gets the number of attributes.

Specified by:
getCount in interface AbsObject
Returns:
the number of attributes.
See Also:
AbsObject.getCount()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Returns true if the attribute is equal to this abstract descriptor, based on the contents of both descriptors.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns an integer hashcode calculated from the contents of this abstract descriptor

Overrides:
hashCode in class java.lang.Object


JADE