Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.drools.planner.core.score
Class DefaultHardAndSoftScore

    java.lang.Object
      org.drools.planner.core.score.AbstractScore<HardAndSoftScore>
          org.drools.planner.core.score.DefaultHardAndSoftScore

All Implemented Interfaces:
  Serializable, Comparable<HardAndSoftScore>, HardAndSoftScore, Score<HardAndSoftScore>

    public final class DefaultHardAndSoftScore

extends AbstractScore<HardAndSoftScore>
implements HardAndSoftScore

Default implementation of `HardAndSoftScore`.

This class is immutable.

See Also:
  `HardAndSoftScore`, Serialized Form

Constructor Summary
`DefaultHardAndSoftScore(int hardScore)`
`DefaultHardAndSoftScore(int hardScore, int softScore)`

Method Summary
`HardAndSoftScore` | `add(HardAndSoftScore augment)` Returns a Score whose value is (this + augment).
`int` | `compareTo(HardAndSoftScore other)`
`HardAndSoftScore` | `divide(double divisor)` Returns a Score whose value is (this / divisor).
`boolean` | `equals(Object o)`
`int` | `getHardScore()` The total of the broken negative hard constraints and fulfilled positive hard constraints.
`int` | `getSoftScore()` The total of the broken negative soft constraints and fulfilled positive soft constraints.
`int` | `hashCode()`
`HardAndSoftScore` | `multiply(double multiplicand)` Returns a Score whose value is (this * multiplicand).
`static DefaultHardAndSoftScore` | `parseScore(String scoreString)`
`HardAndSoftScore` | `subtract(HardAndSoftScore subtrahend)` Returns a Score whose value is (this - subtrahend).
`double[]` | `toDoubleArray()` Returns an array of doubles representing the Score.
`String` | `toString()`
`static DefaultHardAndSoftScore` | `valueOf(int hardScore)`
`static DefaultHardAndSoftScore` | `valueOf(int hardScore, int softScore)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DefaultHardAndSoftScore

    public DefaultHardAndSoftScore(int hardScore)

### DefaultHardAndSoftScore

    public DefaultHardAndSoftScore(int hardScore,
                                   int softScore)

Method Detail

### parseScore

    public static DefaultHardAndSoftScore parseScore(String scoreString)

### valueOf

    public static DefaultHardAndSoftScore valueOf(int hardScore)

### valueOf

    public static DefaultHardAndSoftScore valueOf(int hardScore,
                                                  int softScore)

### getHardScore

    public int getHardScore()

  Description copied from interface: `HardAndSoftScore`
  The total of the broken negative hard constraints and fulfilled positive hard constraints. Their weight is included in the total. The hard score is usually a negative number because most use cases only have negative constraints.

  Specified by:
    `getHardScore` in interface `HardAndSoftScore`
  Returns:
    higher is better, usually negative, 0 if no hard constraints are broken/fulfilled

### getSoftScore

    public int getSoftScore()

  Description copied from interface: `HardAndSoftScore`
  The total of the broken negative soft constraints and fulfilled positive soft constraints. Their weight is included in the total. The soft score is usually a negative number because most use cases only have negative constraints.

  In a normal score comparison, the soft score is irrelevant if the 2 scores don't have the same hard score.

  Specified by:
    `getSoftScore` in interface `HardAndSoftScore`
  Returns:
    higher is better, usually negative, 0 if no soft constraints are broken/fulfilled

### add

    public HardAndSoftScore add(HardAndSoftScore augment)

  Description copied from interface: `Score`
  Returns a Score whose value is (this + augment).

  Specified by:
    `add` in interface `Score<HardAndSoftScore>`
  Parameters:
    `augment` - value to be added to this Score
  Returns:
    this + augment

### subtract

    public HardAndSoftScore subtract(HardAndSoftScore subtrahend)

  Description copied from interface: `Score`
  Returns a Score whose value is (this - subtrahend).

  Specified by:
    `subtract` in interface `Score<HardAndSoftScore>`
  Parameters:
    `subtrahend` - value to be subtracted from this Score
  Returns:
    this - subtrahend, rounded as necessary

### multiply

    public HardAndSoftScore multiply(double multiplicand)

  Description copied from interface: `Score`
  Returns a Score whose value is (this * multiplicand). When rounding is needed, it should be floored (as defined by `Math.floor(double)`.

  Specified by:
    `multiply` in interface `Score<HardAndSoftScore>`
  Parameters:
    `multiplicand` - value to be multiplied by this Score.
  Returns:
    this * multiplicand

### divide

    public HardAndSoftScore divide(double divisor)

  Description copied from interface: `Score`
  Returns a Score whose value is (this / divisor). When rounding is needed, it should be floored (as defined by `Math.floor(double)`.

  Specified by:
    `divide` in interface `Score<HardAndSoftScore>`
  Parameters:
    `divisor` - value by which this Score is to be divided
  Returns:
    this / divisor

### toDoubleArray

    public double[] toDoubleArray()

  Description copied from interface: `Score`
  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}

  Specified by:
    `toDoubleArray` in interface `Score<HardAndSoftScore>`
  Returns:
    never null

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### compareTo

    public int compareTo(HardAndSoftScore other)

  Specified by:
    `compareTo` in interface `Comparable<HardAndSoftScore>`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011 JBoss Inc.. All Rights Reserved.