JADE_SL.abs
Class AbsAggregate

java.lang.Object
  extended byJADE_SL.abs.AbsObjectImpl
      extended byJADE_SL.abs.AbsPrimitiveSlotsHolder
          extended byJADE_SL.abs.AbsConcept
              extended byJADE_SL.abs.AbsAggregate
All Implemented Interfaces:
AbsObject, AbsTerm

public class AbsAggregate
extends AbsConcept

Author:
Federico Bergenti - Universita` di Parma

Field Summary
private  java.util.List elements
           
private static int UNNAMEDPREFIX_LENGTH
           
 
Fields inherited from class JADE_SL.abs.AbsObjectImpl
 
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.
 void dump()
           
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
 java.util.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.
private  int toIndex(java.lang.String name)
           
 java.lang.String toString()
           
 
Methods inherited from class JADE_SL.abs.AbsConcept
getAbsTerm, getBoolean, getByteSequence, getDate, getDouble, getFloat, getInteger, getLong, getString, set, set, set, set, set, set, set, set
 
Methods inherited from class JADE_SL.abs.AbsObjectImpl
getNameEnumeration, getTypeName, set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface JADE_SL.abs.AbsObject
getTypeName
 

Field Detail

UNNAMEDPREFIX_LENGTH

private static final int UNNAMEDPREFIX_LENGTH

elements

private java.util.List elements
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 java.util.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
Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute.
Throws:
java.lang.IllegalArgumentException - if name is not of the form Codec.UNNAMEDPERFIX+index

toIndex

private int toIndex(java.lang.String name)

dump

protected void dump(int indent,
                    java.io.PrintStream ps)
Overrides:
dump in class AbsObjectImpl

getAbsObject

public AbsObject getAbsObject(java.lang.String name)
Overrides this method to check that name is of the form Codec.UNNAMEDPERFIX+index

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

getNames

public java.lang.String[] getNames()
Overrides method in superclass

Specified by:
getNames in interface AbsObject
Overrides:
getNames in class AbsObjectImpl
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:
isGrounded in interface AbsObject
Overrides:
isGrounded in class AbsObjectImpl
Returns:
true if the object is grounded.
See Also:
AbsObject.isGrounded()

getCount

public int getCount()
Overrides method in superclass

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

dump

public void dump()
Specified by:
dump in interface AbsObject
Overrides:
dump in class AbsObjectImpl
See Also:
AbsObject.dump()

toString

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


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.