uk.ed.inf.graph.util.impl
Class FilteredEdgeSet<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>

java.lang.Object
  extended by uk.ed.inf.graph.util.impl.FilteredEdgeSet<N,E>
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>, IEdgeSet<N,E>, IFilteredEdgeSet<N,E>

public class FilteredEdgeSet<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>
extends java.lang.Object
implements IFilteredEdgeSet<N,E>


Constructor Summary
FilteredEdgeSet(IEdgeSet<N,E> edgeSet, IFilterCriteria<E> criteria)
           
 
Method Summary
 boolean add(E edge)
           
 boolean addAll(java.util.Collection<? extends E> c)
           
 void clear()
           
 boolean contains(int edgeIdx)
          Does an edge with this index exist in the set.
 boolean contains(N thisNode, N thatNode)
          Does the edge set contain at least one edge with these nodes.
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection<?> c)
           
 boolean equals(java.lang.Object obj)
           
 E get(int edgeIdx)
          Get the edge with the given index.
 java.util.SortedSet<E> get(N thisNode, N thatNode)
          Get the edges that match the given node connectivity.
 java.util.SortedSet<E> getEdgesWith(N thisNode, N otherNode)
          Gets the edges that contain this node as one of its ends.
 IEdgeSet<N,E> getUnfilteredEdgeSet()
           
 boolean hasEdgesWith(N thisNode, N otherNode)
          Does this edge set contain one or more edges associated with this node?
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Iterator<E> iterator()
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection<?> c)
           
 boolean retainAll(java.util.Collection<?> c)
           
 int size()
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilteredEdgeSet

public FilteredEdgeSet(IEdgeSet<N,E> edgeSet,
                       IFilterCriteria<E> criteria)
Method Detail

getUnfilteredEdgeSet

public IEdgeSet<N,E> getUnfilteredEdgeSet()
Specified by:
getUnfilteredEdgeSet in interface IFilteredEdgeSet<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>

add

public boolean add(E edge)
Specified by:
add in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
add in interface java.util.Set<E extends IBasicEdge<N,E>>

addAll

public boolean addAll(java.util.Collection<? extends E> c)
Specified by:
addAll in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
addAll in interface java.util.Set<E extends IBasicEdge<N,E>>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
clear in interface java.util.Set<E extends IBasicEdge<N,E>>

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
equals in interface java.util.Set<E extends IBasicEdge<N,E>>
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
hashCode in interface java.util.Set<E extends IBasicEdge<N,E>>
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
contains in interface java.util.Set<E extends IBasicEdge<N,E>>

containsAll

public boolean containsAll(java.util.Collection<?> c)
Specified by:
containsAll in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
containsAll in interface java.util.Set<E extends IBasicEdge<N,E>>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
isEmpty in interface java.util.Set<E extends IBasicEdge<N,E>>

iterator

public java.util.Iterator<E> iterator()
Specified by:
iterator in interface java.lang.Iterable<E extends IBasicEdge<N,E>>
Specified by:
iterator in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
iterator in interface java.util.Set<E extends IBasicEdge<N,E>>

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
remove in interface java.util.Set<E extends IBasicEdge<N,E>>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Specified by:
removeAll in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
removeAll in interface java.util.Set<E extends IBasicEdge<N,E>>

retainAll

public boolean retainAll(java.util.Collection<?> c)
Specified by:
retainAll in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
retainAll in interface java.util.Set<E extends IBasicEdge<N,E>>

size

public int size()
Specified by:
size in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
size in interface java.util.Set<E extends IBasicEdge<N,E>>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
toArray in interface java.util.Set<E extends IBasicEdge<N,E>>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface java.util.Collection<E extends IBasicEdge<N,E>>
Specified by:
toArray in interface java.util.Set<E extends IBasicEdge<N,E>>

get

public E get(int edgeIdx)
Description copied from interface: IEdgeSet
Get the edge with the given index.

Specified by:
get in interface IEdgeSet<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>
Parameters:
edgeIdx - The index of the edge to be obtained.
Returns:
The edge with this index. Will not be null.

getEdgesWith

public java.util.SortedSet<E> getEdgesWith(N thisNode,
                                           N otherNode)
Description copied from interface: IEdgeSet
Gets the edges that contain this node as one of its ends.

Specified by:
getEdgesWith in interface IEdgeSet<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>
Parameters:
thisNode - the node that is the point of reference.
otherNode - The node associated with the edges. Cannot be null.
Returns:
The set of edges containing the matched nodes. The set will contain at least one node.

hasEdgesWith

public boolean hasEdgesWith(N thisNode,
                            N otherNode)
Description copied from interface: IEdgeSet
Does this edge set contain one or more edges associated with this node?

Specified by:
hasEdgesWith in interface IEdgeSet<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>
Parameters:
thisNode - The node that is the point of reference.
otherNode - The node to be tested. Can be null.
Returns:
True if one or more edges conatin the node, false otherwise.

contains

public boolean contains(N thisNode,
                        N thatNode)
Description copied from interface: IEdgeSet
Does the edge set contain at least one edge with these nodes. This assumes a direction to the nodes so if the edges are undirected the method must be called for both orientations of the edge.

Specified by:
contains in interface IEdgeSet<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>
Parameters:
thisNode - a node the edge may be connected to.
thatNode - another node the edge may be connected to.
Returns:
True if one or more edges has this connectivity, false otherwise.

get

public java.util.SortedSet<E> get(N thisNode,
                                  N thatNode)
Description copied from interface: IEdgeSet
Get the edges that match the given node connectivity. The connectivity is undirected.

Specified by:
get in interface IEdgeSet<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>
Parameters:
thisNode - a node the edge may be connected to. Cannot be null.
thatNode - another node the edge may be connected to. Cannot be null.
Returns:
The set of edges containing this connectivity. Note that the set is guaranteed to contain at least one edge.

contains

public boolean contains(int edgeIdx)
Description copied from interface: IEdgeSet
Does an edge with this index exist in the set.

Specified by:
contains in interface IEdgeSet<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>
Parameters:
edgeIdx - The edge index.
Returns:
True if an edge matching this index was found, false otherwise.