Package org.opt4j.core
Class CriterionSet<T extends Criterion>
java.lang.Object
org.opt4j.core.CriterionSet<T>
- Direct Known Subclasses:
Constraints
,Objectives
public abstract class CriterionSet<T extends Criterion>
extends Object
implements Iterable<Map.Entry<T,Value<?>>>
Superclass for
Criterion
-Values
pairs. Provides methods for
the administration of these pairs.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(CriterionSet<T> criterionSet) Adds all Criterions with the specified value specified incriterionSet
.void
Adds the Criterion with the specified double value.void
Adds the Criterion with the specified integer value.void
Adds the Criterion with the specified value.abstract double[]
array()
Returns an array of all CriterionSet values.double
distance
(CriterionSet<T> other) Calculates the euclidean distance of twoCriterionSet
s.Returns the Criterion that is assigned to the given value.Value<?>
Returns the value that is assigned to the givenCriterion
.getKeys()
Returns allCriterion
s.Collection<Value<?>>
Returns all values.boolean
isEqual
(CriterionSet<T> opponent) Returnstrue
if this CriterionSet is equal to the specified CriterionSet.iterator()
int
size()
Returns the number of setCriterion
s.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
map
-
array
protected double[] array
-
-
Constructor Details
-
CriterionSet
public CriterionSet()
-
-
Method Details
-
iterator
-
array
public abstract double[] array()Returns an array of all CriterionSet values.- Returns:
- an array containing CriterionSet values
-
size
public int size()Returns the number of setCriterion
s.- Returns:
- the number of set
Criterion
s
-
getKeys
Returns allCriterion
s.- Returns:
- all
Criterion
s
-
getValues
Returns all values.- Returns:
- all values
-
get
Returns the value that is assigned to the givenCriterion
. Returnsnull
if theCriterion
does not exist.- Parameters:
criterion
- the given criterion- Returns:
- the value
-
get
Returns the Criterion that is assigned to the given value. Returnsnull
if the value does not exist.- Parameters:
value
- the given value- Returns:
- the Criterion
-
add
Adds the Criterion with the specified value.- Parameters:
criterion
- the criterionvalue
- the value
-
add
Adds the Criterion with the specified double value.- Parameters:
criterion
- the criterionvalue
- the value
-
add
Adds the Criterion with the specified integer value.- Parameters:
criterion
- the criterionvalue
- the value
-
add
Adds all Criterions with the specified value specified incriterionSet
.- Parameters:
criterionSet
- the criterionSet
-
isEqual
Returnstrue
if this CriterionSet is equal to the specified CriterionSet. This comparison is based on the#array()
values.- Parameters:
opponent
- other CriterionSet- Returns:
true
if the CriterionSets are equal
-
distance
Calculates the euclidean distance of twoCriterionSet
s. This calculation is based on the#array()
values.- Parameters:
other
- the second CriterionSet- Returns:
- the euclidean distance
-