Plexus v0.13.1

com.phoenixst.plexus.util
Class AdjacentNodeCollection

java.lang.Object
  extended by java.util.AbstractCollection
      extended by com.phoenixst.plexus.util.AdjacentNodeCollection
All Implemented Interfaces:
Iterable, Collection

public class AdjacentNodeCollection
extends AbstractCollection

A Collection for nodes to help implement the Graph.adjacentNodes( Predicate ) method.

Since:
1.0
Version:
$Revision: 1.7 $
Author:
Ray A. Conner

Constructor Summary
AdjacentNodeCollection(Graph graph, Object baseNode, org.apache.commons.collections.Predicate traverserPredicate)
          Creates a new AdjacentNodeCollection.
 
Method Summary
 boolean addAll(Collection collection)
          Throws an UnsupportedOperationException.
 boolean contains(Object object)
          This implementation uses Graph.traverser( node, predicate ) and returns true, if found.
 Iterator iterator()
          This implementation returns a wrapper around Graph.traverser( node, predicate ).
 boolean remove(Object object)
          This implementation uses Graph.traverser( node, predicate ) and removes the Graph.Edge to the node, if found.
 int size()
          This implementation delegates to Graph.degree( node, predicate ).
 
Methods inherited from class java.util.AbstractCollection
add, clear, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

AdjacentNodeCollection

public AdjacentNodeCollection(Graph graph,
                              Object baseNode,
                              org.apache.commons.collections.Predicate traverserPredicate)
Creates a new AdjacentNodeCollection. If a null Predicate is passed to this constructor, TruePredicate is used internally.

Method Detail

size

public int size()
This implementation delegates to Graph.degree( node, predicate ).

Specified by:
size in interface Collection
Specified by:
size in class AbstractCollection

remove

public boolean remove(Object object)
This implementation uses Graph.traverser( node, predicate ) and removes the Graph.Edge to the node, if found.

Specified by:
remove in interface Collection
Overrides:
remove in class AbstractCollection

contains

public boolean contains(Object object)
This implementation uses Graph.traverser( node, predicate ) and returns true, if found.

Specified by:
contains in interface Collection
Overrides:
contains in class AbstractCollection

iterator

public Iterator iterator()
This implementation returns a wrapper around Graph.traverser( node, predicate ).

Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in class AbstractCollection

addAll

public boolean addAll(Collection collection)
Throws an UnsupportedOperationException.

Specified by:
addAll in interface Collection
Overrides:
addAll in class AbstractCollection

Plexus v0.13.1

See the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.