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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(CriterionSet<T> criterionSet) Adds all Criterions with the specified value specified incriterionSet.voidAdds the Criterion with the specified double value.voidAdds the Criterion with the specified integer value.voidAdds 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.Returns the Criterion that is assigned to the given value.Value<?>Returns the value that is assigned to the givenCriterion.getKeys()Returns allCriterions.Collection<Value<?>>Returns all values.booleanisEqual(CriterionSet<T> opponent) Returnstrueif this CriterionSet is equal to the specified CriterionSet.iterator()intsize()Returns the number of setCriterions.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 setCriterions.- Returns:
- the number of set
Criterions
-
getKeys
Returns allCriterions.- Returns:
- all
Criterions
-
getValues
Returns all values.- Returns:
- all values
-
get
Returns the value that is assigned to the givenCriterion. Returnsnullif theCriteriondoes not exist.- Parameters:
criterion- the given criterion- Returns:
- the value
-
get
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
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
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
Calculates the euclidean distance of twoCriterionSets. This calculation is based on the#array()values.- Parameters:
other- the second CriterionSet- Returns:
- the euclidean distance
-