|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.cilib.problem.MinimisationFitness
public class MinimisationFitness
This class implements the Comparable
interface for a minimisation problem.
That is, smaller fitness values have superior fitness.
Constructor Summary | |
---|---|
MinimisationFitness(Double value)
Constructs a new MinimisationFitness with the given fitness value. |
|
MinimisationFitness(MinimisationFitness copy)
Create a copy of the given MinimisationFitness. |
Method Summary | |
---|---|
int |
compareTo(Fitness other)
Compare the current fitness instance to the provided instance. |
boolean |
equals(Object obj)
Compare the specified object with this type for equality. |
MinimisationFitness |
getClone()
Create a cloned copy of the current object and return it. |
Double |
getValue()
Returns the underlying fitness value. |
int |
hashCode()
Returns the hash code value for this list. |
Fitness |
newInstance(Double value)
Creation method that maintains Fitness object immutability by returning a new instance of the current class type. |
String |
toString()
Get the textual representation of this Fitness object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MinimisationFitness(Double value)
MinimisationFitness
with the given fitness value.
value
- The actual fitness value for the problem.public MinimisationFitness(MinimisationFitness copy)
copy
- The instance to copy.Method Detail |
---|
public MinimisationFitness getClone()
getClone
in interface Fitness
getClone
in interface Type
getClone
in interface Cloneable
Object.clone()
public Double getValue()
getValue
in interface Fitness
public final Fitness newInstance(Double value)
newInstance
in interface Fitness
value
- The desired value of the Fitness
object.public int compareTo(Fitness other)
compareTo
in interface Comparable<Fitness>
compareTo
in interface Fitness
other
- The fitness to be compared.
Comparable
public boolean equals(Object obj)
true
if and only if the specified object is also an instance
of the same type.
equals
in interface Type
equals
in class Object
obj
- The object to compare.
true
if equality exists, false
otherwise.Object.equals(Object)
public int hashCode()
int hashCode = 7; Iterator<E> i = list.iterator(); while (i.hasNext()) { E obj = i.next(); hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode()); }This ensures that type1.equals(type2) implies that type1.hashCode()==type2.hashCode() for any two types, type1 and type2, as required by the general contract of
Object.hashCode()
.
hashCode
in interface Type
hashCode
in class Object
Object.equals(Object)
,
Type.equals(Object)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |