public static final class Knapsack.Item extends Object implements Serializable
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
double |
getSize()
Return the item size.
|
double |
getValue()
Return the item value.
|
int |
hashCode() |
static Knapsack.Item |
of(double size,
double value)
Return a new knapsack
Item with the given size and
value . |
static Knapsack.Item |
random(Random random)
Create a new random knapsack item for testing purpose.
|
String |
toString() |
static Collector<Knapsack.Item,?,Knapsack.Item> |
toSum()
Return a
Collector , which sums the size and value of knapsack
items. |
public double getSize()
public double getValue()
public static Knapsack.Item of(double size, double value)
Item
with the given size
and
value
.size
- the item sizevalue
- the item valueItem
IllegalArgumentException
- if one of the parameters is smaller
then zeropublic static Knapsack.Item random(Random random)
random
- the random engine used for creating the knapsack itemNullPointerException
- if the random engine is null
public static Collector<Knapsack.Item,?,Knapsack.Item> toSum()
Collector
, which sums the size and value of knapsack
items.Collector
© 2007-2017 Franz Wilhelmstötter (2017-04-27 23:07)