JACK 5.4 JACOB Application Interface

aos.apib
Interface Aggregate

All Known Implementing Classes:
BaseList

public interface Aggregate

An interface for a list of objects known as an 'aggregation' in Jacob. The default aggregation implementation is a Java array, but this can be replaced with a user defined Aggregate implementation. An aggregation is ordered and allows access to items by position, with 0 being the first position.

See Also:
BaseList

Method Summary
 Base addAfter(Base existing_obj, Base obj)
          Adds a Jacob Base Object to the Aggregate one position after an Object already present in the Aggregate.
 Base addAt(Base obj, int index)
          Adds a Jacob Base Object to the Aggregate at the given index position.
 Base addBefore(Base existing_obj, Base obj)
          Adds a Jacob Base Object to the Aggregate one position before an Object already present in the Aggregate.
 Base addFirst(Base obj)
          Adds a Jacob Base Object to the start of the Aggregate.
 Base addLast(Base obj)
          Adds a Jacob Base Object to the end of the Aggregate.
 Base elementAt(int index)
          Returns the Jacob Base element at the given index of the Aggregate.
 java.util.Enumeration elements()
          Returns the Aggregate as an Enumeration of elements of type AggregateEnumeration.
 void empty()
          Permanently removes all elements currently stored in the Aggregate.
 int getSize()
          Returns the number of elements currently stored in the Aggregate.
 Base replace(Base old_obj, Base new_obj)
          Replaces a Jacob Base Object currently stored in the Aggregate with a new one.
 Base rm(Base obj)
          Removes a given Jacob Base Object from the Aggregate.
 Base rmAt(int index)
          Removes a Jacob Base Object from the Aggregate at a given index position.
 

Method Detail

getSize

public int getSize()
Returns the number of elements currently stored in the Aggregate.

Returns:
the number of elements currently stored in the Aggregate.

elementAt

public Base elementAt(int index)
Returns the Jacob Base element at the given index of the Aggregate. If the index is less than zero, or greater than the index of the last element in the Aggregate, this method returns null.

Parameters:
index - the index of the Jacob Base Object to be retrieved.
Returns:
the Jacob Base Object at the given index of the Aggregate; otherwise null.

addFirst

public Base addFirst(Base obj)
Adds a Jacob Base Object to the start of the Aggregate.

Returns:
the Jacob Base Object that was added to the start of the Aggregate.

addLast

public Base addLast(Base obj)
Adds a Jacob Base Object to the end of the Aggregate.

Returns:
the Jacob Base Object that was added to the end of the Aggregate.

addAt

public Base addAt(Base obj,
                  int index)
Adds a Jacob Base Object to the Aggregate at the given index position. Any Base Objects in the Aggregate located at or after the given index will be shifted to make way for the new Object.

If the given index is less than zero, this method will return null. However, if the index given is greater than the index of the last element in the Aggregate, the new Object will simply be added to the end of the Aggregate. Under normal circumstances, this method returns the Object added to the Aggregate.

Parameters:
index - the index at which the Jacob Base Object should be added.
Returns:
the Jacob Base Object that was added to the Aggregate; otherwise null.

rmAt

public Base rmAt(int index)
Removes a Jacob Base Object from the Aggregate at a given index position. Any Base Objects in the Aggregate located after the given index will be shifted to fill the space left by the removed Object.

If the given index is less than zero, or greater than the index of the last element in the Aggregate, this method will return null. Otherwise, the removed Object is returned.

Parameters:
index - the index of the Jacob Base Object to be removed from the Aggregate.
Returns:
the Jacob Base Object that was removed from the Aggregate; otherwise null.

replace

public Base replace(Base old_obj,
                    Base new_obj)
Replaces a Jacob Base Object currently stored in the Aggregate with a new one.

If the Object to replace does not exist in the Aggregate, this method will return null. Otherwise, the Object that was added is returned.

Returns:
the Jacob Base Object that was added to the Aggregate; otherwise null.

rm

public Base rm(Base obj)
Removes a given Jacob Base Object from the Aggregate. Any Base Objects in the Aggregate located after the given Object will be shifted to fill the space left by its removal.

If the given Object does not exist in the Aggregate, this method will return null. Otherwise, the removed Object is returned.

Returns:
the Jacob Base Object that was removed from the Aggregate; otherwise null.

addBefore

public Base addBefore(Base existing_obj,
                      Base obj)
Adds a Jacob Base Object to the Aggregate one position before an Object already present in the Aggregate. Any Base Objects in the Aggregate located before the Object in the second parameter will be shifted to make way for the new Object.

If the object in the second parameter cannot be found, this method will return null. Otherwise, the added Object is returned.

Returns:
the Jacob Base Object that was added to the Aggregate; otherwise null.

addAfter

public Base addAfter(Base existing_obj,
                     Base obj)
Adds a Jacob Base Object to the Aggregate one position after an Object already present in the Aggregate. Any Base Objects in the Aggregate located after the Object in the second parameter will be shifted to make way for the new Object.

If the object in the second parameter cannot be found, this method will return null. Otherwise, the added Object is returned.

Returns:
the Jacob Base Object that was added to the Aggregate; otherwise null.

empty

public void empty()
Permanently removes all elements currently stored in the Aggregate.


elements

public java.util.Enumeration elements()
Returns the Aggregate as an Enumeration of elements of type AggregateEnumeration.

Returns:
the Aggregate as an Enumeration of elements of type AggregateEnumeration.

JACK 5.4 JACOB Application Interface

Copyright (C) 1999-2008, Agent Oriented Software Pty. Ltd.

US Government Restricted Rights
The JACK Modules and relevant Software Material have been developed entirely at private expense and are accordingly provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013 or subparagraph (c)(1) and (2) of the Commercial Computer Software Restricted Rights and 48 CFR 52.2270-19, as applicable.


Agent Oriented Software Pty. Ltd.     http://www.aosgrp.com
PO Box 639, Carlton South, Victoria 3053, Australia
Phone: +61 3 9349 5055, Fax: +61 3 9349 5088