Package jade.content.abs
Class AbsAggregate
- java.lang.Object
-
- jade.content.abs.AbsObjectImpl
-
- jade.content.abs.AbsPrimitiveSlotsHolder
-
- jade.content.abs.AbsConcept
-
- jade.content.abs.AbsAggregate
-
- All Implemented Interfaces:
AbsObject,AbsTerm,Concept,Term,Serializable,Serializable
public class AbsAggregate extends AbsConcept
An abstract descriptor that can hold an aggregate entitiy expression.- Author:
- 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 AbsAggregate(String typeName)Construct an Abstract descriptor to hold an aggregate of the proper type (i.e.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(AbsTerm element)Adds a new element (that must be a term) to this aggregate.voidclear()Clear all the elements in this aggregate.booleancontains(AbsTerm element)Test if a given term is contained in this aggregate.protected voiddump(int indent, PrintStream ps)AbsTermget(int i)Retrieves thei-th element in this aggregate.AbsObjectgetAbsObject(String name)Overrides this method to check that name is of the form Codec.UNNAMEDPERFIX+indexintgetAbsType()intgetCount()Overrides method in superclassAbsTermgetElementTemplate()Get the abstract template of aggregate elementString[]getNames()Overrides method in superclassintindexOf(AbsTerm element)Returns the position of an element within this aggregate.booleanisEmpty()Test if the aggregate is empty.booleanisGrounded()Tests if this AbsAggregate is grounded, i.e., if no one of its elements is associated with a variableIteratoriterator()AbsTermremove(int index)Removes the element at the given position from this aggregate.booleanremove(AbsTerm element)Removes an element from this aggregate.voidset(String name, AbsTerm value)Overrides this method to check that name is of the form Codec.UNNAMEDPERFIX+indexvoidsetElementTemplate(AbsTerm elementTemplate)Set the abstract template of aggregate elementintsize()Retrieves the number of elements in this aggregate.AbsTerm[]toArray()Retrieve all elements in this aggregate in the form of an array.StringtoString()This method is here just for debugging.-
Methods inherited from class jade.content.abs.AbsConcept
getAbsTerm, getJavaClass
-
Methods inherited from class jade.content.abs.AbsPrimitiveSlotsHolder
getBoolean, getByteSequence, getDate, getDouble, getFloat, getInteger, getLong, getString, set, set, set, set, set, set, set, set, set
-
Methods inherited from class jade.content.abs.AbsObjectImpl
equals, getAbsObject, getTypeName, getValues, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jade.content.abs.AbsObject
getTypeName
-
-
-
-
Constructor Detail
-
AbsAggregate
public AbsAggregate(String typeName)
Construct an Abstract descriptor to hold an aggregate of the proper type (i.e. SET, SEQUENCE...).- Parameters:
typeName- The name of the type of the aggregate held by this abstract descriptor.
-
-
Method Detail
-
add
public void add(AbsTerm element)
Adds a new element (that must be a term) to this aggregate.- Parameters:
element- The element to add.
-
size
public int size()
Retrieves the number of elements in this aggregate.- Returns:
- The number of elements.
-
get
public AbsTerm get(int i)
Retrieves thei-th element in this aggregate.- Parameters:
i- The index of the element to retrieve.- Returns:
- The element.
-
iterator
public Iterator iterator()
- Returns:
- An
Iteratorover the elements of this aggregate.
-
clear
public void clear()
Clear all the elements in this aggregate.
-
contains
public boolean contains(AbsTerm element)
Test if a given term is contained in this aggregate.- Returns:
trueif the given term is contained in this aggregate.
-
indexOf
public int indexOf(AbsTerm element)
Returns the position of an element within this aggregate.- Returns:
- The position of an element within this aggregate.
-
remove
public AbsTerm remove(int index)
Removes the element at the given position from this aggregate.- Returns:
- The removed element.
-
remove
public boolean remove(AbsTerm element)
Removes an element from this aggregate.- Returns:
- The removed element.
-
isEmpty
public boolean isEmpty()
Test if the aggregate is empty.- Returns:
trueif this aggregate does not contain any element.
-
toArray
public AbsTerm[] toArray()
Retrieve all elements in this aggregate in the form of an array.- Returns:
- An array containing all elements in this aggregate.
-
set
public void set(String name, AbsTerm value)
Overrides this method to check that name is of the form Codec.UNNAMEDPERFIX+index- Overrides:
setin classAbsConcept- Parameters:
name- The name of the attribute to be set.value- The new value of the attribute.- Throws:
IllegalArgumentException- if name is not of the form Codec.UNNAMEDPERFIX+index
-
dump
protected void dump(int indent, PrintStream ps)
-
getAbsObject
public AbsObject getAbsObject(String name)
Overrides this method to check that name is of the form Codec.UNNAMEDPERFIX+index- Specified by:
getAbsObjectin interfaceAbsObject- Overrides:
getAbsObjectin classAbsObjectImpl- Parameters:
name- The name of the attribute.- Returns:
- value The value of the attribute.
- See Also:
AbsObject.getAbsObject(String)
-
getNames
public String[] getNames()
Overrides method in superclass- Specified by:
getNamesin interfaceAbsObject- Overrides:
getNamesin classAbsObjectImpl- Returns:
- the name of all attributes.
- See Also:
AbsObject.getNames()
-
isGrounded
public boolean isGrounded()
Tests if this AbsAggregate is grounded, i.e., if no one of its elements is associated with a variable- Specified by:
isGroundedin interfaceAbsObject- Overrides:
isGroundedin classAbsObjectImpl- Returns:
trueif the object is grounded.- See Also:
AbsObject.isGrounded()
-
getCount
public int getCount()
Overrides method in superclass- Specified by:
getCountin interfaceAbsObject- Overrides:
getCountin classAbsObjectImpl- Returns:
- the number of attributes.
- See Also:
AbsObject.getCount()
-
getAbsType
public int getAbsType()
- Specified by:
getAbsTypein interfaceAbsObject- Overrides:
getAbsTypein classAbsConcept
-
getElementTemplate
public AbsTerm getElementTemplate()
Get the abstract template of aggregate element
-
setElementTemplate
public void setElementTemplate(AbsTerm elementTemplate)
Set the abstract template of aggregate element
-
toString
public String toString()
This method is here just for debugging. Notice that it is highly innefficient. The method StringCodec.encode() should be used instead.- Overrides:
toStringin classAbsObjectImpl
-
-