org.drools.planner.core.score
Interface Score<S extends Score>

All Superinterfaces:
Comparable<S>
All Known Subinterfaces:
HardAndSoftLongScore, HardAndSoftScore, SimpleDoubleScore, SimpleScore
All Known Implementing Classes:
AbstractScore, DefaultHardAndSoftLongScore, DefaultHardAndSoftScore, DefaultSimpleDoubleScore, DefaultSimpleScore

public interface Score<S extends Score>
extends Comparable<S>

A Score is result of the score function (AKA fitness function) on a single possible solution.

Implementations must be immutable.

See Also:
AbstractScore, DefaultHardAndSoftScore

Method Summary
 S add(S augment)
          Returns a Score whose value is (this + augment).
 S divide(double divisor)
          Returns a Score whose value is (this / divisor).
 S multiply(double multiplicand)
          Returns a Score whose value is (this * multiplicand).
 S subtract(S subtrahend)
          Returns a Score whose value is (this - subtrahend).
 double[] toDoubleArray()
          Returns an array of doubles representing the Score.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

add

S add(S augment)
Returns a Score whose value is (this + augment).

Parameters:
augment - value to be added to this Score
Returns:
this + augment

subtract

S subtract(S subtrahend)
Returns a Score whose value is (this - subtrahend).

Parameters:
subtrahend - value to be subtracted from this Score
Returns:
this - subtrahend, rounded as necessary

multiply

S multiply(double multiplicand)
Returns a Score whose value is (this * multiplicand). When rounding is needed, it should be floored (as defined by Math.floor(double).

Parameters:
multiplicand - value to be multiplied by this Score.
Returns:
this * multiplicand

divide

S divide(double divisor)
Returns a Score whose value is (this / divisor). When rounding is needed, it should be floored (as defined by Math.floor(double).

Parameters:
divisor - value by which this Score is to be divided
Returns:
this / divisor

toDoubleArray

double[] toDoubleArray()
Returns an array of doubles representing the Score. When rounding is needed, each rounding should be floored (as defined by Math.floor(double).

A greater score level uses a lower array index than a lesser score level. The length of the returned array is stable for a specific Score implementation. For example: -0hard/-7soft returns new double{-0.0, -7.0}

Returns:
never null


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.