Rule Execution Server API

ilog.rules.engine
Class IlrDefaultCollector

java.lang.Object
  extended by ilog.rules.engine.IlrDefaultCollector
All Implemented Interfaces:
IlrCollection, Serializable, Iterable, Collection

public class IlrDefaultCollector
extends Object
implements IlrCollection, Serializable, Collection

This class defines the collector used by a collect condition for which a collector is not provided.

See Also:
Serialized Form

Field Summary
protected  Vector elements
          This vector contains the elements of the collection.
 
Constructor Summary
IlrDefaultCollector()
          Constructs a collector with no arguments.
 
Method Summary
 boolean add(Object o)
          Ensures that this collection contains the specified element.
 boolean addAll(Collection c)
          Adds all of the elements in the specified collection to this collection.
 void addElement(Object element)
          Adds the specified element to the vector.
 void clear()
          Removes all of the elements from this collection.
 boolean contains(Object element)
          Tests if the collection contains some specific object using the equals method.
 boolean containsAll(Collection c)
          Returns true if this collection contains all the elements in the specified collection.
 Enumeration copyElements()
          Creates an enumeration to visit all the elements of the collection.
 Enumeration elements()
          Creates an enumeration to visit all the elements of the collection.
 boolean equals(Object o)
          Compares the specified object with this collection for equality.
 int hashCode()
          Returns the hash code value for this collection.
 boolean isEmpty()
          Tests if the collection is empty.
 Iterator iterator()
          Returns an iterator over the elements in this collection.
 boolean remove(Object o)
          Removes the occurrence of the specified element in the collected object.
 boolean removeAll(Collection c)
          Removes all of the elements from this collection that are contained in the specified collection.
 void removeElement(Object element)
          Removes the specified element from the vector.
 boolean retainAll(Collection c)
          Retains only the elements in this collection that are contained in the specified collection.
 int size()
          Gets the number of elements currently in this collection.
 Object[] toArray()
          Returns an array containing all of the collected elements.
 Object[] toArray(Object[] a)
          Returns an array containing all of the collected elements whose runtime type is that of the specified array.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ilog.rules.engine.IlrCollection
updateElement
 

Field Detail

elements

protected Vector elements

This vector contains the elements of the collection.

Constructor Detail

IlrDefaultCollector

public IlrDefaultCollector()

Constructs a collector with no arguments.

Method Detail

size

public final int size()

Gets the number of elements currently in this collection.

Specified by:
size in interface Collection
Returns:
The number of elements in this collection.

isEmpty

public final boolean isEmpty()

Tests if the collection is empty.

Specified by:
isEmpty in interface Collection
Returns:
true if the collection contains no objects, and false if the collection has at least one object.

contains

public final boolean contains(Object element)

Tests if the collection contains some specific object using the equals method.

Specified by:
contains in interface Collection
Parameters:
element - An object.
Returns:
true if the specified object is a member of this collection, and false otherwise.

elements

public final Enumeration elements()

Creates an enumeration to visit all the elements of the collection. This method does not save (or copy) the elements. During the visit, any changes to the collection may impact the enumeration.

Returns:
An enumeration.

copyElements

public final Enumeration copyElements()

Creates an enumeration to visit all the elements of the collection. This method creates a new holder containing the elements and returns an enumeration of that holder. As the elements are saved in a specific data structure, the returned enumeration will not be impacted by any changes on the collection.

Returns:
An enumeration.

addElement

public void addElement(Object element)

Adds the specified element to the vector. The element is added at the end of the vector without any membership testing.

Specified by:
addElement in interface IlrCollection
Parameters:
element - The element to add.

removeElement

public void removeElement(Object element)

Removes the specified element from the vector. If the vector does not contain the element, no element is removed.

Specified by:
removeElement in interface IlrCollection
Parameters:
element - The element to removed.

add

public boolean add(Object o)
Ensures that this collection contains the specified element. It returns true if this collection changed as a result of the call. (It returns false if this collection does not permit duplicates and already contains the specified element.)

Specified by:
add in interface Collection
Parameters:
o - The element whose presence in this collection is to be ensured.
Returns:
true if this collection changed as a result of the call.

addAll

public boolean addAll(Collection c)
Adds all of the elements in the specified collection to this collection.

Specified by:
addAll in interface Collection
Parameters:
c - The elements to be inserted into this collection.
Returns:
true if this collection changed as a result of the call.

clear

public void clear()
Removes all of the elements from this collection. This collection will be empty after this method returns unless it throws an exception.

Specified by:
clear in interface Collection

containsAll

public boolean containsAll(Collection c)
Returns true if this collection contains all the elements in the specified collection.

Specified by:
containsAll in interface Collection
Parameters:
c - The collection to be checked for containment in this collection.
Returns:
true if this collection contains all of the elements in the specified collection.

equals

public boolean equals(Object o)
Compares the specified object with this collection for equality. Two collectors are equal if they are of the same class, have the same size, and if all the collected elements are respectively equal.

Specified by:
equals in interface Collection
Overrides:
equals in class Object
Parameters:
o - The object to be compared for equality with this collection.
Returns:
true if the specified object is equal to this collection.

hashCode

public int hashCode()
Returns the hash code value for this collection.

Specified by:
hashCode in interface Collection
Overrides:
hashCode in class Object
Returns:
The hash code value for this collection.

iterator

public Iterator iterator()
Returns an iterator over the elements in this collection.

Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Returns:
An Iterator over the elements in this collection.

remove

public boolean remove(Object o)
Removes the occurrence of the specified element in the collected object. Returns true if the specified object was contained in this collection.

Specified by:
remove in interface Collection
Parameters:
o - The object to be removed from this collection, if present.
Returns:
true if the collection contained the specified element.

removeAll

public boolean removeAll(Collection c)
Removes all of the elements from this collection that are contained in the specified collection.

Specified by:
removeAll in interface Collection
Parameters:
c - The collection that contains all the objects to be removed.
Returns:
true if this collection changed as a result of the call.

retainAll

public boolean retainAll(Collection c)
Retains only the elements in this collection that are contained in the specified collection. In other words, it removes all of the elements from this collection that are not contained in the specified collection.

Specified by:
retainAll in interface Collection
Parameters:
c - The collection that contains all the objects to be retained.
Returns:
true if this collection changed as a result of the call.

toArray

public Object[] toArray()
Returns an array containing all of the collected elements.

Specified by:
toArray in interface Collection
Returns:
The array containing all of the elements of the collection.

toArray

public Object[] toArray(Object[] a)
Returns an array containing all of the collected elements whose runtime type is that of the specified array. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this collection.

Specified by:
toArray in interface Collection
Parameters:
a - The array into which the elements of this collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns:
The array containing all of the elements of the collection.

Rule Execution Server API

© Copyright IBM Corp. 1987, 2013