jade.content.abs
Class AbsAggregate

java.lang.Object
  |
  +--jade.content.abs.AbsObjectImpl
        |
        +--jade.content.abs.AbsPrimitiveSlotsHolder
              |
              +--jade.content.abs.AbsConcept
                    |
                    +--jade.content.abs.AbsAggregate

public class AbsAggregate
extends AbsConcept

Author:
Federico Bergenti - Universita` di Parma, Giovanni Caire - TILAB
See Also:
Serialized Form

Constructor Summary
AbsAggregate(java.lang.String typeName)
          Construct an Abstract descriptor to hold an aggregate of the proper type (i.e.
 
Method Summary
 void add(AbsTerm element)
          Adds a new element (that must be a term) to this aggregate.
 void clear()
          Clear all the elements in this aggregate.
 boolean contains(AbsTerm element)
          Test if a given term is contained in this aggregate.
protected  void dump(int indent, java.io.PrintStream ps)
           
 AbsTerm get(int i)
          Retrieves the i-th element in this aggregate.
 AbsObject getAbsObject(java.lang.String name)
          Overrides this method to check that name is of the form Codec.UNNAMEDPERFIX+index
 int getCount()
          Overrides method in superclass
 java.lang.String[] getNames()
          Overrides method in superclass
 int indexOf(AbsTerm element)
          Returns the position of an element within this aggregate.
 boolean isEmpty()
          Test if the aggregate is empty.
 boolean isGrounded()
          Tests if this AbsAggregate is grounded, i.e., if no one of its elements is associated with a variable
 Iterator iterator()
           
 boolean remove(AbsTerm element)
          Removes an element from this aggregate.
 AbsTerm remove(int index)
          Removes the element at the given position from this aggregate.
 void set(java.lang.String name, AbsTerm value)
          Overrides this method to check that name is of the form Codec.UNNAMEDPERFIX+index
 int size()
          Retrieves the number of elements in this aggregate.
 AbsTerm[] toArray()
          Retrieve all elements in this aggregate in the form of an array.
 java.lang.String toString()
           
 
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
 
Methods inherited from class jade.content.abs.AbsObjectImpl
equals, getTypeName, hashCode, set
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbsAggregate

public AbsAggregate(java.lang.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 the i-th element in this aggregate.
Parameters:
i - The index of the element to retrieve.
Returns:
The element.

iterator

public Iterator iterator()
Returns:
An Iterator over 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:
true if 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:
true if 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(java.lang.String name,
                AbsTerm value)
Overrides this method to check that name is of the form Codec.UNNAMEDPERFIX+index
Overrides:
set in class AbsConcept
Throws:
java.lang.IllegalArgumentException - if name is not of the form Codec.UNNAMEDPERFIX+index

dump

protected void dump(int indent,
                    java.io.PrintStream ps)

getAbsObject

public AbsObject getAbsObject(java.lang.String name)
Overrides this method to check that name is of the form Codec.UNNAMEDPERFIX+index
Overrides:
getAbsObject in class AbsObjectImpl
Tags copied from interface: AbsObject
Parameters:
name - The name of the attribute.
Returns:
value The value of the attribute.

getNames

public java.lang.String[] getNames()
Overrides method in superclass
Overrides:
getNames in class AbsObjectImpl
Tags copied from interface: AbsObject
Returns:
the name of all attributes.

isGrounded

public boolean isGrounded()
Tests if this AbsAggregate is grounded, i.e., if no one of its elements is associated with a variable
Overrides:
isGrounded in class AbsObjectImpl
Returns:
true if the object is grounded.

getCount

public int getCount()
Overrides method in superclass
Overrides:
getCount in class AbsObjectImpl
Tags copied from interface: AbsObject
Returns:
the number of attributes.

toString

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