br.usp.ime.klava.segmentit.util
Class Cost

java.lang.Object
  extended by br.usp.ime.klava.segmentit.util.Cost

public class Cost
extends java.lang.Object

Represents a lexicographic cost with two components.

Author:
Bruno Klava

Constructor Summary
Cost()
          Creates a lexicographic cost (Infinity, Infinity).
Cost(int max, int dist)
          Creates a lexicographic cost (max, dist).
 
Method Summary
 int getDist()
          Returns the value of dist (second component of the cost).
 int getMax()
          Returns the value of max (first component of the cost).
 boolean greaterThan(Cost cost)
          Returns if this cost is greater than the given cost.
 boolean isInfinity()
          Returns if this cost is equal to (Infinity, Infinity).
 void setCost(int max, int dist)
          Sets this cost to (max, dist).
 void setInfinity()
          Sets this cost to (Infinity, Infinity).
 java.lang.String toString()
          Returns a String representation of this cost.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cost

public Cost()
Creates a lexicographic cost (Infinity, Infinity).


Cost

public Cost(int max,
            int dist)
Creates a lexicographic cost (max, dist).

Parameters:
max - the first component of the cost
dist - the second component of the cost
Method Detail

getMax

public int getMax()
Returns the value of max (first component of the cost).

Returns:
the value of max

getDist

public int getDist()
Returns the value of dist (second component of the cost).

Returns:
the value of dist

setInfinity

public void setInfinity()
Sets this cost to (Infinity, Infinity).


setCost

public void setCost(int max,
                    int dist)
Sets this cost to (max, dist).

Parameters:
max - the first component of the cost
dist - the second component of the cost

isInfinity

public boolean isInfinity()
Returns if this cost is equal to (Infinity, Infinity).

Returns:
true if this cost is equal to (Infinity, Infinity)

greaterThan

public boolean greaterThan(Cost cost)
Returns if this cost is greater than the given cost.

Parameters:
cost - the cost to be compared
Returns:
true if this cost is greater than cost

toString

public java.lang.String toString()
Returns a String representation of this cost.

Overrides:
toString in class java.lang.Object