org.gersteinlab.tyna.core.operators
Class Union

java.lang.Object
  extended by org.gersteinlab.tyna.core.operators.Union
All Implemented Interfaces:
BinaryOperator

public class Union
extends java.lang.Object
implements BinaryOperator

        This class defines the union binary operator. It takes two graphs as
        inputs, and produces a graph as outputs, according to the following
        rules:

        . The two graphs must be both directed or both undirected.
        . The set of nodes of the resulting graph is the union of the sets of
          nodes of the two original graphs.
        . There is an edge in the resulting graph from a node n1 to a node n2 if
          and only if at least one of the original graphs contains an edge from
          n1 to n2.
        . No matter how many edges are there from n1 to n2 in the original
          graphs, there is at most one edge from n1 to n2 in the resulting
          graph.
        

Version:
1.0 (November 5, 2005) Change History: 1.0 - Initial version
Author:
Kevin Yuk-Lap Yip

Constructor Summary
Union()
           
 
Method Summary
 boolean associative()
          Whether the operator is associative, i.e., whether a op (b op c) equals (a op b) op c.
 boolean commutative()
          Whether the operator is commutative, i.e., whether a op b equals b op a.
 Graph operate(Graph g1, Graph g2)
          Perform the operation on two graphs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Union

public Union()
Method Detail

operate

public Graph operate(Graph g1,
                     Graph g2)
              throws GraphTypeException
Description copied from interface: BinaryOperator
Perform the operation on two graphs.

Specified by:
operate in interface BinaryOperator
Parameters:
g1 - The first graph
g2 - The second graph
Returns:
The resulting graph
Throws:
GraphTypeException - If there are problems with the types of the input graphs

associative

public boolean associative()
Description copied from interface: BinaryOperator
Whether the operator is associative, i.e., whether a op (b op c) equals (a op b) op c.

Specified by:
associative in interface BinaryOperator
Returns:
Whether the operator is associative

commutative

public boolean commutative()
Description copied from interface: BinaryOperator
Whether the operator is commutative, i.e., whether a op b equals b op a.

Specified by:
commutative in interface BinaryOperator
Returns:
Whether the operator is commutative