net.xqhs.graphs.representation.linear
Class LinearGraphRepresentation.NodeInAlphaComparator

java.lang.Object
  extended by net.xqhs.graphs.graph.NodeAlphaComparator
      extended by net.xqhs.graphs.representation.linear.LinearGraphRepresentation.NodeInAlphaComparator
All Implemented Interfaces:
java.util.Comparator<Node>
Enclosing class:
LinearGraphRepresentation

static class LinearGraphRepresentation.NodeInAlphaComparator
extends NodeAlphaComparator

Compares two Node structures. First criterion: node with lower in-degree in the graph (given in constructor) is first; second criterion is lexical order (using NodeAlphaComparator).

Author:
Andrei Olaru

Field Summary
protected  Graph theGraph
          The graph containing the nodes to be compared.
 
Constructor Summary
LinearGraphRepresentation.NodeInAlphaComparator(Graph graph)
          Default constructor.
 
Method Summary
 int compare(Node n0, Node n1)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

theGraph

protected Graph theGraph
The graph containing the nodes to be compared.

Constructor Detail

LinearGraphRepresentation.NodeInAlphaComparator

public LinearGraphRepresentation.NodeInAlphaComparator(Graph graph)
Default constructor. The graph is needed to calculate the in-degree.

Parameters:
graph - - the graph to which the nodes to compare belong.
Method Detail

compare

public int compare(Node n0,
                   Node n1)
Specified by:
compare in interface java.util.Comparator<Node>
Overrides:
compare in class NodeAlphaComparator