org.jrdf.graph
Interface Collection

All Known Implementing Classes:
CollectionImpl

public interface Collection

A Collection holds all the statements of a particular group. A linked list is created by using pointer statements (REST) to the next item in the collection. The group is closed, where the last statement in the group points to a NIL entry. See 4.1 RDF Collections.

Version:
$Revision: 1.1 $
Author:
Andrew Newman

Method Summary
 void add(int index, Object element)
          Add an $ObjectNode to the collection at the given position.
 boolean add(Object element)
          Add an $ObjectNode to the collection.
 boolean addAll(Collection c)
          Add a collection of $ObjectNodes to this one.
 boolean addAll(int index, Collection c)
          Add a collection of $ObjectNodes to this one starting at the given index.
 void addFirst(Object element)
          Add an $ObjectNode to the start of the collection.
 void addLast(Object element)
           
 boolean contains(Object element)
          Search the collection and return if the object was found or not.
 boolean containsAll(Collection c)
          Search the collection and return if all of the given objects were found.
 int indexOf(Object element)
           
 Iterator iterator()
           
 int lastIndexOf(Object element)
           
 boolean remove(Object element)
           
 boolean removeAll(Collection c)
           
 boolean retainAll(Collection c)
           
 Object set(int index, Object element)
           
 

Method Detail

add

public boolean add(Object element)
            throws IllegalArgumentException
Add an $ObjectNode to the collection.

Parameters:
element - object to add.
Returns:
true if the object was added successfully.
Throws:
IllegalArgumentException - if the given object is not the correct type, ObjectNode.

add

public void add(int index,
                Object element)
         throws IllegalArgumentException
Add an $ObjectNode to the collection at the given position.

Parameters:
index - the index into the collection to add.
element - the object to add.
Throws:
IllegalArgumentException - if the given object is not the correct type, ObjectNode.

addAll

public boolean addAll(Collection c)
               throws IllegalArgumentException
Add a collection of $ObjectNodes to this one.

Parameters:
c - the collection to add.
Returns:
true if the object was added successfully.
Throws:
IllegalArgumentException - if the given object is not the correct type, Collection.

addAll

public boolean addAll(int index,
                      Collection c)
               throws IllegalArgumentException
Add a collection of $ObjectNodes to this one starting at the given index.

Parameters:
index - the index into the collection to start adding.
c - the collection to add.
Returns:
true if the object was added successfully.
Throws:
IllegalArgumentException - if the given object is not the correct type, Collection.

addFirst

public void addFirst(Object element)
Add an $ObjectNode to the start of the collection.

Throws:
IllegalArgumentException - if the given object is not the correct type, ObjectNode.

addLast

public void addLast(Object element)
Throws:
IllegalArgumentException - if the given object is not the correct type, ObjectNode.

contains

public boolean contains(Object element)
Search the collection and return if the object was found or not.

Returns:
true of the object was found.
Throws:
IllegalArgumentException - if the given object is not the correct type, ObjectNode.

containsAll

public boolean containsAll(Collection c)
Search the collection and return if all of the given objects were found.

Parameters:
c - the collection containing the elements to search.
Returns:
true if all of the given objects were found.
Throws:
IllegalArgumentException - if the given object is not the correct type, Collection.

indexOf

public int indexOf(Object element)
            throws IllegalArgumentException
Throws:
IllegalArgumentException - if the given object is not the correct type, ObjectNode.

iterator

public Iterator iterator()

lastIndexOf

public int lastIndexOf(Object element)
                throws IllegalArgumentException
Throws:
IllegalArgumentException - if the given object is not the correct type, ObjectNode.

remove

public boolean remove(Object element)
               throws IllegalArgumentException
Throws:
IllegalArgumentException - if the given object is not the correct type, ObjectNode.

removeAll

public boolean removeAll(Collection c)
                  throws IllegalArgumentException
Throws:
IllegalArgumentException - if the given object is not the correct type, Collection.

retainAll

public boolean retainAll(Collection c)
                  throws IllegalArgumentException
Throws:
IllegalArgumentException - if the given object is not the correct type, Collection.

set

public Object set(int index,
                  Object element)
           throws IllegalArgumentException
Throws:
IllegalArgumentException - if the given object is not the correct type, ObjectNode.