mss.ea.eval
Class AbstractScore
java.lang.Object
|
+--mss.ea.eval.AbstractScore
- All Implemented Interfaces:
- java.lang.Comparable, Score, java.io.Serializable
- Direct Known Subclasses:
- CompoundScore, DoubleScore, FloatScore, IntegerScore, LongScore
- public abstract class AbstractScore
- extends java.lang.Object
- implements Score
Abstract base class for scores of individuals.
- Since:
- 0.1
- Version:
- 0.1 (06-20-2001)
- Author:
- Andreas Rummler
- See Also:
- Serialized Form
Method Summary |
abstract int |
compareTo(java.lang.Object o)
Compares two scores.
|
boolean |
isBetter(Score s)
Comparison, if this score is better than another. |
boolean |
isEqual(Score s)
Test for equality. |
boolean |
isWorse(Score s)
Comparison, if this score is worse than another. |
abstract java.lang.Object |
value()
Gets the value of the score as an object.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractScore
public AbstractScore()
isBetter
public boolean isBetter(Score s)
- Comparison, if this score is better than another.
- Specified by:
isBetter
in interface Score
- Parameters:
s
- score to compare with- Returns:
- result of comparison
isWorse
public boolean isWorse(Score s)
- Comparison, if this score is worse than another.
- Specified by:
isWorse
in interface Score
- Parameters:
s
- score to compare to- Returns:
- result of comparison
isEqual
public boolean isEqual(Score s)
- Test for equality.
- Specified by:
isEqual
in interface Score
- Parameters:
s
- score to compare with- Returns:
- result of test
value
public abstract java.lang.Object value()
- Gets the value of the score as an object.
In subclasses there can be methods like floatValue() to get the value without a cast.
- Specified by:
value
in interface Score
- Returns:
- value of the score
compareTo
public abstract int compareTo(java.lang.Object o)
- Compares two scores.
This method is necessary to implement the interface Comparable. Each subclass will do a cast to the type
of itself, if the cast fails a ClassCastException is thrwon. Because of this, scores of for instance types float
and int cannot be compared. In this case a separate ScoreComparator must be used.
- Specified by:
compareTo
in interface java.lang.Comparable
- Parameters:
o
- score to compare to- Returns:
- result of comparison
Copyright © 2000-2001 Technical University of Ilmenau, Department ESS