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 forCriterion-Valuespairs. Provides methods for the administration of these pairs.
-
-
Constructor Summary
Constructors Constructor Description CriterionSet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(CriterionSet<T> criterionSet)Adds all Criterions with the specified value specified incriterionSet.voidadd(T criterion, double value)Adds the Criterion with the specified double value.voidadd(T criterion, int value)Adds the Criterion with the specified integer value.voidadd(T criterion, Value<?> value)Adds the Criterion with the specified value.abstract double[]array()Returns an array of all CriterionSet values.doubledistance(CriterionSet<T> other)Calculates the euclidean distance of twoCriterionSets.Tget(Value<?> value)Returns the Criterion that is assigned to the given value.Value<?>get(T criterion)Returns the value that is assigned to the givenCriterion.Collection<T>getKeys()Returns allCriterions.Collection<Value<?>>getValues()Returns all values.booleanisEqual(CriterionSet<T> opponent)Returnstrueif this CriterionSet is equal to the specified CriterionSet.Iterator<Map.Entry<T,Value<?>>>iterator()intsize()Returns the number of setCriterions.-
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
-
-
-
-
Method Detail
-
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 setCriterions.- Returns:
- the number of set
Criterions
-
getKeys
public Collection<T> getKeys()
Returns allCriterions.- Returns:
- all
Criterions
-
getValues
public Collection<Value<?>> getValues()
Returns all values.- Returns:
- all values
-
get
public Value<?> get(T criterion)
Returns the value that is assigned to the givenCriterion. Returnsnullif theCriteriondoes not exist.- Parameters:
criterion- the given criterion- Returns:
- the value
-
get
public T get(Value<?> value)
Returns the Criterion that is assigned to the given value. Returnsnullif the value does not exist.- Parameters:
value- the given value- Returns:
- the Criterion
-
add
public void add(T criterion, Value<?> value)
Adds the Criterion with the specified value.- Parameters:
criterion- the criterionvalue- the value
-
add
public void add(T criterion, double value)
Adds the Criterion with the specified double value.- Parameters:
criterion- the criterionvalue- the value
-
add
public void add(T criterion, int value)
Adds the Criterion with the specified integer value.- Parameters:
criterion- the criterionvalue- the value
-
add
public void add(CriterionSet<T> criterionSet)
Adds all Criterions with the specified value specified incriterionSet.- Parameters:
criterionSet- the criterionSet
-
isEqual
public boolean isEqual(CriterionSet<T> opponent)
Returnstrueif this CriterionSet is equal to the specified CriterionSet. This comparison is based on the#array()values.- Parameters:
opponent- other CriterionSet- Returns:
trueif the CriterionSets are equal
-
distance
public double distance(CriterionSet<T> other)
Calculates the euclidean distance of twoCriterionSets. This calculation is based on the#array()values.- Parameters:
other- the second CriterionSet- Returns:
- the euclidean distance
-
-