Plexus v0.13.1

com.phoenixst.plexus.operations
Class Join

java.lang.Object
  extended by com.phoenixst.plexus.AbstractGraph
      extended by com.phoenixst.plexus.operations.Join
All Implemented Interfaces:
Graph, Serializable
Direct Known Subclasses:
CompleteBipartiteGraph, Star, Wheel

public class Join
extends AbstractGraph
implements Serializable

A Graph which is the join of two other Graphs with disjoint node sets. This implementation does not actually check that the node sets are disjoint, but will definitely behave strangely if they are not. The new edges added to the the union of the two graphs may be directed or undirected as specified in the constructor. These new edges never contain user-defined objects.

Since:
1.0
Version:
$Revision: 1.59 $
Author:
Ray A. Conner
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.phoenixst.plexus.Graph
Graph.Edge
 
Constructor Summary
Join(Graph left, Graph right, boolean isDirected)
          Creates a new Join graph.
 
Method Summary
 boolean containsEdge(Graph.Edge edge)
          This implementation traverses over the edges in this graph incident on the tail of the specified edge, looking for it and returning true if found.
 boolean containsNode(Object node)
          Returns true if this Graph contains node.
 int degree(Object node)
          Returns the degree of node, defined as the number of edges incident on node, with self-loops counted twice.
protected  Collection edges()
          Returns a Collection view of all the Graph.Edges in this Graph.
 Graph getLeftOperand()
           
 Graph getRightOperand()
           
protected  Collection nodes()
          Returns a Collection view of all the nodes in this Graph.
 boolean removeEdge(Graph.Edge edge)
          Throws an UnsupportedOperationException.
 boolean removeNode(Object node)
          Throws an UnsupportedOperationException.
 String toString()
           
protected  Traverser traverser(Object node)
          Returns an unfiltered Traverser over those Graph.Edges incident to the specified node.
 
Methods inherited from class com.phoenixst.plexus.AbstractGraph
addEdge, addNode, adjacentNodes, degree, edges, getAdjacentNode, getEdge, getIncidentEdge, getNode, incidentEdges, nodes, traverser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Join

public Join(Graph left,
            Graph right,
            boolean isDirected)
Creates a new Join graph.

Parameters:
left - the first (left) graph operand for the join operation.
right - the second (right) graph operand for the join operation.
isDirected - whether or not the new edges added as part of the join operation are directed. If true, nodes from the first operand are the tails of the edges.
Method Detail

getLeftOperand

public Graph getLeftOperand()

getRightOperand

public Graph getRightOperand()

nodes

protected Collection nodes()
Description copied from class: AbstractGraph
Returns a Collection view of all the nodes in this Graph. This method is only called by nodes( Predicate ).

Specified by:
nodes in class AbstractGraph

edges

protected Collection edges()
Description copied from class: AbstractGraph
Returns a Collection view of all the Graph.Edges in this Graph. This method is only called by edges( Predicate ).

Specified by:
edges in class AbstractGraph

traverser

protected Traverser traverser(Object node)
Description copied from class: AbstractGraph
Returns an unfiltered Traverser over those Graph.Edges incident to the specified node. This method is only called by traverser( node, Predicate ).

Specified by:
traverser in class AbstractGraph

containsNode

public boolean containsNode(Object node)
Returns true if this Graph contains node.

Specified by:
containsNode in interface Graph
Overrides:
containsNode in class AbstractGraph
Parameters:
node - the node whose presence in this Graph is to be tested.
Returns:
true if this Graph contains the specified node.

removeNode

public boolean removeNode(Object node)
Throws an UnsupportedOperationException.

Specified by:
removeNode in interface Graph
Overrides:
removeNode in class AbstractGraph
Parameters:
node - the node to be removed from this Graph.
Returns:
true if this Graph contained node.

containsEdge

public boolean containsEdge(Graph.Edge edge)
This implementation traverses over the edges in this graph incident on the tail of the specified edge, looking for it and returning true if found.

Specified by:
containsEdge in interface Graph
Overrides:
containsEdge in class AbstractGraph
Parameters:
edge - the Graph.Edge whose presence in this Graph is to be tested.
Returns:
true if this Graph contains the specified Graph.Edge.

removeEdge

public boolean removeEdge(Graph.Edge edge)
Throws an UnsupportedOperationException.

Specified by:
removeEdge in interface Graph
Overrides:
removeEdge in class AbstractGraph
Parameters:
edge - the Graph.Edge to be removed from this Graph.
Returns:
true if this Graph contained the specified Graph.Edge.

degree

public int degree(Object node)
Returns the degree of node, defined as the number of edges incident on node, with self-loops counted twice.

Specified by:
degree in interface Graph
Overrides:
degree in class AbstractGraph
Parameters:
node - return the degree of this node.
Returns:
the degree of node.

toString

public String toString()
Overrides:
toString in class Object

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.