Package org.opt4j.core.genotype
Interface MapGenotype<K,V>
-
- Type Parameters:
K
- the type of keysV
- the type of values
- All Known Implementing Classes:
BooleanMapGenotype
,DoubleMapGenotype
,IntegerMapGenotype
,SelectMapGenotype
public interface MapGenotype<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ERROR_MESSAGE_INVALID_KEY
static java.lang.String
ERROR_MESSAGE_NON_UNIQUE_KEYS
static java.lang.String
ERROR_MESSAGE_OUT_OF_BOUNDS
static java.lang.String
ERROR_MESSAGE_UNSUPPORTED_INIT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
containsKey(K key)
Returnstrue
if the key is contained.int
getIndexOf(K key)
Returns the index of the key.java.util.Collection<K>
getKeys()
Return all keys.V
getValue(K key)
Returns the value for the specified key.void
setValue(K key, V value)
Sets the value for the specified key.
-
-
-
Field Detail
-
ERROR_MESSAGE_NON_UNIQUE_KEYS
static final java.lang.String ERROR_MESSAGE_NON_UNIQUE_KEYS
- See Also:
- Constant Field Values
-
ERROR_MESSAGE_INVALID_KEY
static final java.lang.String ERROR_MESSAGE_INVALID_KEY
- See Also:
- Constant Field Values
-
ERROR_MESSAGE_OUT_OF_BOUNDS
static final java.lang.String ERROR_MESSAGE_OUT_OF_BOUNDS
- See Also:
- Constant Field Values
-
ERROR_MESSAGE_UNSUPPORTED_INIT
static final java.lang.String ERROR_MESSAGE_UNSUPPORTED_INIT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getKeys
java.util.Collection<K> getKeys()
Return all keys.- Returns:
- all keys
-
getValue
V getValue(K key)
Returns the value for the specified key. Throws an exception if the key is not contained.- Parameters:
key
- the key- Returns:
- the value
- See Also:
setValue(K, V)
-
setValue
void setValue(K key, V value)
Sets the value for the specified key. Throws an exception if the key is not contained.- Parameters:
key
- the keyvalue
- the value- See Also:
getValue(K)
-
containsKey
boolean containsKey(K key)
Returnstrue
if the key is contained.- Parameters:
key
- the key- Returns:
true
if the key is contained
-
getIndexOf
int getIndexOf(K key)
Returns the index of the key. Throws an exception if the key is not contained.- Parameters:
key
- the key- Returns:
- the index
-
-