Package org.eso.ias.types
Class NumericArray
java.lang.Object
org.eso.ias.types.NumericArray
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The supported types of array -
Field Summary
Modifier and TypeFieldDescriptionThe not null immutable array of itemsThe type of the items of the arrays -
Constructor Summary
ConstructorDescriptionNumericArray
(NumericArray.NumericArrayType numericArrayType) Constructor with no elements in the arrayNumericArray
(NumericArray.NumericArrayType numericArrayType, List<? extends Number> elements) Constructor with a list of elements in the arrayNumericArray
(scala.collection.immutable.List<? extends scala.AnyVal> elements, NumericArray.NumericArrayType numericArrayType) Constructor with a scala list of elements in the array -
Method Summary
Modifier and TypeMethodDescriptionReturn a new NumericArray with the passed value appended at the end of array of elementsclear()
Build and return a NumericArray with the same type and no elementsReturn the elements as a comma separated string of valuesboolean
get
(int i) Return the element at the given position of the arraysint
hashCode()
boolean
isEmpty()
Return a new NumericArray with the passed value saved in the index positionint
size()
Number[]
toArray()
Double[]
Return the arrays as an array of DoubleLong[]
Return the arrays as an array of Long Note that depending on the type of the array (DOUBLE for instance) the numbers of the returned array differ from the original (rounded)toString()
static NumericArray
valueOf
(NumericArray.NumericArrayType type, String strValue) Builds ansd return a NumericArray of the given type by decoding the passed string.
-
Field Details
-
numericArrayType
The type of the items of the arrays -
array
The not null immutable array of items
-
-
Constructor Details
-
NumericArray
Constructor with no elements in the array- Parameters:
numericArrayType
- The type of the items of the arrays
-
NumericArray
public NumericArray(NumericArray.NumericArrayType numericArrayType, List<? extends Number> elements) Constructor with a list of elements in the array- Parameters:
numericArrayType
- The type of the items of the arrayselements
- the elements in the array (can be null)
-
NumericArray
public NumericArray(scala.collection.immutable.List<? extends scala.AnyVal> elements, NumericArray.NumericArrayType numericArrayType) Constructor with a scala list of elements in the array- Parameters:
elements
- the elements in the array (can be null)numericArrayType
- The type of the items of the arrays
-
-
Method Details
-
clear
Build and return a NumericArray with the same type and no elements- Returns:
- a new empty NumericArray
-
add
Return a new NumericArray with the passed value appended at the end of array of elements- Parameters:
value
- the not null value to append to the arrays- Returns:
- A NumericElement with the passed value appended
-
set
Return a new NumericArray with the passed value saved in the index position- Parameters:
index
- The index in the arraysvalue
- The value to set in the index position- Throws:
IndexOutOfBoundsException
- - if the index is out of range (index < 0 || index > size())
-
get
Return the element at the given position of the arrays- Parameters:
i
- the index of the element to get- Returns:
- The Number at the given position of the arrays
- See Also:
-
toArray
- Returns:
- An array with all the elements in the
ArrayList
-
toArrayOfLong
Return the arrays as an array of Long Note that depending on the type of the array (DOUBLE for instance) the numbers of the returned array differ from the original (rounded)- Returns:
- the array of Long
-
toArrayOfDouble
Return the arrays as an array of Double- Returns:
- the array sof Double
-
size
public int size()- Returns:
- the number of element sin the arrays
- See Also:
-
isEmpty
public boolean isEmpty()- Returns:
- true if the array is empty, false otherwise
- See Also:
-
valueOf
Builds ansd return a NumericArray of the given type by decoding the passed string. The items in the String must be separated by a coma.- Parameters:
type
- The type of the arraysstrValue
- The string with the elements of the array
-
toString
-
codeToString
Return the elements as a comma separated string of values- Returns:
- A string with the values separated by a comma
-
equals
-
hashCode
public int hashCode()
-