de.unidu.is.util
Class WeightedString

java.lang.Object
  extended byde.unidu.is.util.WeightedString
All Implemented Interfaces:
java.lang.Comparable

public class WeightedString
extends java.lang.Object
implements java.lang.Comparable

A (string,weight) pair, which can be sorted with decreasing weights.

Since:
2005-01-10
Version:
$Revision: 1.3 $, $Date: 2005/02/21 17:29:29 $
Author:
Henrik Nottelmann

Field Summary
protected  java.lang.String string
          The string.
protected  double weight
          The weight of the string.
 
Constructor Summary
WeightedString()
          Creates a new, empty instance.
WeightedString(java.lang.String string, double weight)
          Creates a new instance.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compares this entry (the score in decreasing order) with the specified one.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getString()
          Returns the string.
 double getWeight()
          Returns the weight of the string.
 int hashCode()
           
 void setString(java.lang.String string)
          Sets the string.
 void setWeight(double weight)
          Sets the weight of the string.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

string

protected java.lang.String string
The string.


weight

protected double weight
The weight of the string.

Constructor Detail

WeightedString

public WeightedString()
Creates a new, empty instance.


WeightedString

public WeightedString(java.lang.String string,
                      double weight)
Creates a new instance.

Parameters:
string - string
weight - weight
Method Detail

getString

public java.lang.String getString()
Returns the string.

Returns:
string

setString

public void setString(java.lang.String string)
Sets the string.

Parameters:
string - string.

getWeight

public double getWeight()
Returns the weight of the string.

Returns:
weight of the string.

setWeight

public void setWeight(double weight)
Sets the weight of the string.

Parameters:
weight - weight of the string

equals

public boolean equals(java.lang.Object obj)

compareTo

public int compareTo(java.lang.Object obj)
Compares this entry (the score in decreasing order) with the specified one.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - the reference object with which to compare.
Returns:
negative, zero, positive

hashCode

public int hashCode()

toString

public java.lang.String toString()