|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.cilib.problem.MaximisationFitness
public class MaximisationFitness
Comparable
interface for a maximisation problem.
That is, larger fitness values have superior fitness.Constructor Summary | |
---|---|
MaximisationFitness(Double value)
Constructs a new MaximisationFitness with the given fitness value. |
|
MaximisationFitness(MaximisationFitness copy)
Copy constructor. |
Method Summary | |
---|---|
int |
compareTo(Fitness other)
Returns superior fitness for larger fitness values. |
boolean |
equals(Object obj)
Compare the specified object with this type for equality. |
MaximisationFitness |
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MaximisationFitness(Double value)
MaximisationFitness
with the given fitness value.
value
- The actual fitness value for the problem.public MaximisationFitness(MaximisationFitness copy)
copy
- The instance to copy.Method Detail |
---|
public MaximisationFitness 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |