datamodel
Class Term

java.lang.Object
  extended by datamodel.Term
All Implemented Interfaces:
java.lang.Comparable

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

Class representing a term or token. All texts contains a set of terms or tokens. This class also hold information on frequency and weight of the term.

Author:
Kjell-Inge Skogstad and Trond Řivind Eriksen

Constructor Summary
Term(java.lang.String term, int frequency, double weight)
          Constructor that creates a new term.
 
Method Summary
 int compareTo(java.lang.Object arg0)
          Method for comparing the weights of two terms.
 int getFrequency()
          Method that returns the frequency of the term.
 double getWeight()
          Method that returns the weight of the term.
 void setFrequency(int frequency)
          Method that sets the frequency.
 void setWeight(double weight)
          Method for setting the weight of the term.
 java.lang.String toString()
          Method that returns the term.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Term

public Term(java.lang.String term,
            int frequency,
            double weight)
Constructor that creates a new term.

Parameters:
term - The term
frequency - The frequency
Method Detail

toString

public java.lang.String toString()
Method that returns the term.

Overrides:
toString in class java.lang.Object
Returns:
The term

setFrequency

public void setFrequency(int frequency)
Method that sets the frequency.

Parameters:
frequency - The frequency

getFrequency

public int getFrequency()
Method that returns the frequency of the term.

Returns:
The frequency

getWeight

public double getWeight()
Method that returns the weight of the term.

Returns:
The weight

setWeight

public void setWeight(double weight)
Method for setting the weight of the term.

Parameters:
weight - The new weight

compareTo

public int compareTo(java.lang.Object arg0)
Method for comparing the weights of two terms.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
arg0 - Term to compare with
Returns:
Decision