Module org.cicirello.chips_n_salsa
Interface IntegerValued
- All Known Implementing Classes:
BoundedIntegerVector
,IntegerVector
,SingleInteger
,UndoableUniformMutation
,UniformMutation
public interface IntegerValued
An interface to define the parameters to a function, where the function parameters are
represented as integers. Classes implementing this interface may be applicable for function
optimization problems.
-
Method Summary
Modifier and TypeMethodDescriptionint
get
(int i) Accesses the current value of a specified parameter.int
length()
Gets the number of parameters.default void
set
(int[] values) Sets all values from an array (copies values from the array).void
set
(int i, int value) Sets a function parameter to a specified value.int[]
toArray
(int[] values) Accesses the current values of all of the parameters.
-
Method Details
-
length
int length()Gets the number of parameters.- Returns:
- The number of parameters for this function.
-
get
int get(int i) Accesses the current value of a specified parameter.- Parameters:
i
- The parameter to get.- Returns:
- The current value of the i-th parameter.
- Throws:
ArrayIndexOutOfBoundsException
- if i < 0 or i ≥ length().
-
toArray
int[] toArray(int[] values) Accesses the current values of all of the parameters.- Parameters:
values
- An array to hold the result. If values is null or if values.length is not equal to this.length(), then a new array is constructed for the result.- Returns:
- An array containing the current values of all of the parameters.
-
set
void set(int i, int value) Sets a function parameter to a specified value.- Parameters:
i
- The parameter to set.value
- The new value for the i-th parameter.- Throws:
ArrayIndexOutOfBoundsException
- if i < 0 or i ≥ length().
-
set
default void set(int[] values) Sets all values from an array (copies values from the array).- Parameters:
values
- an array of new values
-