org.jrdf.graph.mem
Class AbstractUnorderedContainer<ObjectNode>

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

public abstract class AbstractUnorderedContainer<ObjectNode>
extends Object
implements Container<ObjectNode>

The base class for the implementation of Bag and Alternative.

Version:
$Revision: 1045 $
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)
          
 void clear()
           
 boolean contains(Object o)
          
abstract  boolean equals(Object o)
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator<ObjectNode> iterator()
          
 boolean remove(Object o)
          
 int size()
           
 ObjectNode[] toArray()
           
<ObjectNode>
ObjectNode[]
toArray(ObjectNode[] a)
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jrdf.graph.Container
addAll, containsAll, removeAll, retainAll
 

Field Detail

elements

protected 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

size

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

isEmpty

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

contains

public boolean contains(Object o)
Description copied from interface: Container

Specified by:
contains in interface Collection<ObjectNode>
Specified by:
contains in interface Container<ObjectNode>

iterator

public Iterator<ObjectNode> iterator()
Description copied from interface: Container

Specified by:
iterator in interface Iterable<ObjectNode>
Specified by:
iterator in interface Collection<ObjectNode>
Specified by:
iterator in interface Container<ObjectNode>
Returns:

toArray

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

toArray

public <ObjectNode> ObjectNode[] toArray(ObjectNode[] a)
Description copied from interface: Container

Specified by:
toArray in interface Collection<ObjectNode>
Specified by:
toArray in interface Container<ObjectNode>
Returns:

add

public boolean add(ObjectNode o)
Description copied from interface: Container

Specified by:
add in interface Collection<ObjectNode>
Specified by:
add in interface Container<ObjectNode>
Parameters:
o - Add an ObjectNode.
Returns:

remove

public boolean remove(Object o)
Description copied from interface: Container

Specified by:
remove in interface Collection<ObjectNode>
Specified by:
remove in interface Container<ObjectNode>
Parameters:
o -

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

equals

public abstract boolean equals(Object o)
Specified by:
equals in interface Collection<ObjectNode>
Overrides:
equals in class Object