de.kumpe.hadooptimizer
Class EvaluationResult<I>

java.lang.Object
  extended by de.kumpe.hadooptimizer.EvaluationResult<I>
Type Parameters:
I - the individuals' type
All Implemented Interfaces:
Serializable, Comparable<EvaluationResult<I>>

public final class EvaluationResult<I>
extends Object
implements Comparable<EvaluationResult<I>>, Serializable

Represents an immutable result of an evaluation.

Note: a instance is considered immutable, so you should not modify the contained individual. See getIndividual() for additional hints.

Author:
Christian Kumpe
See Also:
Serialized Form

Constructor Summary
EvaluationResult(I individual, double evaluation)
          Creates a new EvaluationResult with the given individual and its evaluation.
 
Method Summary
 int compareTo(EvaluationResult<I> other)
          Compares two EvaluationResults.
 boolean equals(Object obj)
          Two EvaluationResults are equal, if their evaluations are equal.
 double getEvaluation()
          The calculated evaluation for the individual.
 I getIndividual()
          Return the individual for which the evaluation was calculated.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EvaluationResult

public EvaluationResult(I individual,
                        double evaluation)
Creates a new EvaluationResult with the given individual and its evaluation.

Throws:
NullPointerException - if individual is null
Method Detail

getEvaluation

public double getEvaluation()
The calculated evaluation for the individual.

Returns:
the calculated evaluation-value (fitness)

getIndividual

public I getIndividual()
Return the individual for which the evaluation was calculated.

Note: An instance of EvaluationResult is considered to be immutable, but for performance reasons the contained individual is not copied. So don't modify the returned individual.

Returns:
the individual; cannot be null

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Two EvaluationResults are equal, if their evaluations are equal.

Overrides:
equals in class Object

compareTo

public int compareTo(EvaluationResult<I> other)
Compares two EvaluationResults.

The natural order of two EvaluationResults is the order of their evaluations.

Specified by:
compareTo in interface Comparable<EvaluationResult<I>>
See Also:
Comparable.compareTo(Object)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Christian Kumpe. All Rights Reserved.