org.jrdf.graph.local.mem
Class AbstractUnorderedContainer

java.lang.Object
  extended by org.jrdf.graph.local.mem.AbstractUnorderedContainer
All Implemented Interfaces:
Iterable<ObjectNode>, Collection<ObjectNode>, Container
Direct Known Subclasses:
AlternativeImpl, BagImpl

public abstract class AbstractUnorderedContainer
extends Object
implements Container

The base class for the implementation of Bag and Alternative.

Version:
$Revision: 1804 $
Author:
Andrew Newman

Field Summary
protected  Map<Long,ObjectNode> elements
          The hashmap containing the elements.
protected  long key
          Counter used to generate keys to add to the hashmap.
 
Constructor Summary
AbstractUnorderedContainer()
           
 
Method Summary
 boolean add(ObjectNode o)
           
 boolean addAll(Collection<? extends ObjectNode> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator<ObjectNode> iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals
 

Field Detail

elements

protected final Map<Long,ObjectNode> elements
The hashmap containing the elements.


key

protected long key
Counter used to generate keys to add to the hashmap.

Constructor Detail

AbstractUnorderedContainer

public AbstractUnorderedContainer()
Method Detail

add

public boolean add(ObjectNode o)
Specified by:
add in interface Collection<ObjectNode>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<ObjectNode>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<ObjectNode>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<ObjectNode>

addAll

public boolean addAll(Collection<? extends ObjectNode> c)
               throws IllegalArgumentException
Specified by:
addAll in interface Collection<ObjectNode>
Throws:
IllegalArgumentException

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<ObjectNode>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<ObjectNode>

iterator

public Iterator<ObjectNode> iterator()
Specified by:
iterator in interface Iterable<ObjectNode>
Specified by:
iterator in interface Collection<ObjectNode>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<ObjectNode>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<ObjectNode>

size

public int size()
Specified by:
size in interface Collection<ObjectNode>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<ObjectNode>

clear

public void clear()
Specified by:
clear in interface Collection<ObjectNode>

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<ObjectNode>
Overrides:
hashCode in class Object