net.walend.measured
Class SimpleCEPathMeter

java.lang.Object
  |
  +--net.walend.measured.SimpleCEPathMeter
All Implemented Interfaces:
CEPathMeter, java.io.Serializable
Direct Known Subclasses:
SimplePathMeter

public class SimpleCEPathMeter
extends java.lang.Object
implements CEPathMeter, java.io.Serializable

This simple path meter returns 1 for the cost to cross an edge and 0 for everything else.

Author:
David Walend dfw1@cornell.edu
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface net.walend.measured.CEPathMeter
GENERICEDGE
 
Constructor Summary
SimpleCEPathMeter()
           
 
Method Summary
 double costToCross(java.lang.Object fromNode, java.lang.Object toNode, java.lang.Object edge)
          The cost to cross an edge.
 int intCostToCross(java.lang.Object fromNode, java.lang.Object toNode, java.lang.Object edge)
          The cost to cross an edge.
 boolean negativeWeightEdges()
          Since the cost to cross any edge is 0 or 1, this always returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCEPathMeter

public SimpleCEPathMeter()
Method Detail

costToCross

public double costToCross(java.lang.Object fromNode,
                          java.lang.Object toNode,
                          java.lang.Object edge)
The cost to cross an edge.

Specified by:
costToCross in interface CEPathMeter
Parameters:
edge - is the edge object. In a generic-edge path or digraph, this will be GENERICEDGE.

intCostToCross

public int intCostToCross(java.lang.Object fromNode,
                          java.lang.Object toNode,
                          java.lang.Object edge)
The cost to cross an edge.

Specified by:
intCostToCross in interface CEPathMeter
Parameters:
edge - is the edge object. In a generic-edge path or digraph, this will be GENERICEDGE.

negativeWeightEdges

public boolean negativeWeightEdges()
Since the cost to cross any edge is 0 or 1, this always returns false.

Returns true if this PathMeter can return negative weight edges, false if not. Shortest path algorithms use this method to trigger the bellman-ford algorithm to detect negative weight cycles. If you're not sure, return true.

Specified by:
negativeWeightEdges in interface CEPathMeter


Copyright (c) 2001, 2002, David Walend