org.gersteinlab.tyna.core.operators
Class Difference

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

public class Difference
extends java.lang.Object
implements BinaryOperator

        This class defines the set difference 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.
        . There is an edge in the resulting graph from a node n1 to a node n2 if
          and only if the first graph contains an edge from n1 to n2, but the
          second graph does not.
        . A node appears in the resulting graph if and only if either it is an
          end point of an edge that appears in the first graph but not the
          second, or a node that appears in the first graph but not the second.
        . 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 (December 7, 2005) Change History: 1.0 - Initial version
Author:
Kevin Yuk-Lap Yip

Constructor Summary
Difference()
           
 
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

Difference

public Difference()
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