org.progeeks.graph
Class AbstractFilteredNodeCollection

java.lang.Object
  extended by java.util.AbstractCollection
      extended by com.phoenixst.plexus.util.AbstractNodeCollection
          extended by org.progeeks.graph.AbstractFilteredNodeCollection
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection

public abstract class AbstractFilteredNodeCollection
extends com.phoenixst.plexus.util.AbstractNodeCollection

Extends AbstractNodeCollection to provide support for a predicate. Subclasses must still define their own iterator() and it must already be filtered. This makes it easier to define optimized support for certain predicates in special graph implementations.

Version:
$Revision: 1.2 $
Author:
Paul Speed

Field Summary
 
Fields inherited from class com.phoenixst.plexus.util.AbstractNodeCollection
graph
 
Constructor Summary
protected AbstractFilteredNodeCollection(org.apache.commons.collections.Predicate nodeFilter, com.phoenixst.plexus.Graph graph)
           
 
Method Summary
 boolean contains(java.lang.Object object)
          Overridden to check the object with the filter before calling the superclass contains method.
 org.apache.commons.collections.Predicate getFilter()
           
abstract  java.util.Iterator iterator()
          Must be implemented by subclasses to return an already filtered iterator.
 boolean remove(java.lang.Object object)
          Overridden to check the object with the filter before calling the superclass remove method.
 
Methods inherited from class com.phoenixst.plexus.util.AbstractNodeCollection
addAll, isEmpty, size
 
Methods inherited from class java.util.AbstractCollection
add, clear, containsAll, 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

AbstractFilteredNodeCollection

protected AbstractFilteredNodeCollection(org.apache.commons.collections.Predicate nodeFilter,
                                         com.phoenixst.plexus.Graph graph)
Method Detail

getFilter

public org.apache.commons.collections.Predicate getFilter()

remove

public boolean remove(java.lang.Object object)
Overridden to check the object with the filter before calling the superclass remove method.

Specified by:
remove in interface java.util.Collection
Overrides:
remove in class com.phoenixst.plexus.util.AbstractNodeCollection

contains

public boolean contains(java.lang.Object object)
Overridden to check the object with the filter before calling the superclass contains method.

Specified by:
contains in interface java.util.Collection
Overrides:
contains in class com.phoenixst.plexus.util.AbstractNodeCollection

iterator

public abstract java.util.Iterator iterator()
Must be implemented by subclasses to return an already filtered iterator.

Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in class java.util.AbstractCollection


Copyright © 2002-2003 Paul Speed. All Rights Reserved.