Package hec.heclib.util
Class doubleArrayContainer
java.lang.Object
hec.heclib.util.doubleArrayContainer
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptiondoubleArrayContainer
(double[] values) doubleArrayContainer
(int numberElements) -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
isDefined
(intContainer elementNumber) boolean
double
maximum()
double
maximum
(intContainer elementNumber) double
minimum()
Returns the minimum value in the array.double
minimum
(intContainer elementNumber) int
resize
(int numberElements) Resize the array.int
resize
(int numberElements, int beginningElement) Resize the array.int
resize
(int numberElements, int beginningElementOld, int beginningElementNew) Resize the array, while moving elements (a more complex resize) numberElements is the new size beginningElementOld is the position in the old array to start copying from beginningElementNew is the position in the new array to start copying to This function can be used to increase the size of the array (most common), or remove data from the beginning and end of the array.void
set
(int elementNumber, double value) int
setSize
(int numberElements) void
shiftLeft
(int elementPosition) Shifts all elements at a position in the array marked by "elementPosition" to the left until the item at element position is the first item in the list.
-
Field Details
-
array
public double[] array -
length
public int length
-
-
Constructor Details
-
doubleArrayContainer
public doubleArrayContainer() -
doubleArrayContainer
public doubleArrayContainer(double[] values) -
doubleArrayContainer
public doubleArrayContainer(int numberElements)
-
-
Method Details
-
shiftLeft
public void shiftLeft(int elementPosition) Shifts all elements at a position in the array marked by "elementPosition" to the left until the item at element position is the first item in the list. The emply slots in the array are filled with the UNDEFINED value i.e. shiftLeft(2) takes the array {1,2,3,4,5} and changes it to {3,4,5,UNDEF,UNDEF}- Parameters:
elementPosition
-
-
setSize
public int setSize(int numberElements) -
resize
public int resize(int numberElements) Resize the array. numberElements is the new size Removes elements from the end, or adds elements to the end Example: For an arrary of 3, then resize(5) resize(2) 10 --> 10 10 11 11 11 12 12 __ __ -
resize
public int resize(int numberElements, int beginningElement) Resize the array. numberElements is the new size beginningElement is where to start deleting elements from, if decreasing beginningElement is where to start adding (undefined) elements to, if increasing Example: For an arrary of 3, then resize(5,1) resize(2,1) 10 --> 10 10 11 __ 12 12 __ 11 12 -
resize
public int resize(int numberElements, int beginningElementOld, int beginningElementNew) Resize the array, while moving elements (a more complex resize) numberElements is the new size beginningElementOld is the position in the old array to start copying from beginningElementNew is the position in the new array to start copying to This function can be used to increase the size of the array (most common), or remove data from the beginning and end of the array. Example: For an arrary of 3, then resize(5,1,2) resize(2,1,1) 10 --> __ __ 11 __ 11 12 11 12 __ Any new values are undefined. -
set
public void set(int elementNumber, double value) -
maximum
-
minimum
-
minimum
public double minimum()Returns the minimum value in the array.- Returns:
- double minimum value
-
maximum
public double maximum() -
isDefined
-
isDefined
public boolean isDefined() -
isValidValue
public boolean isValidValue()
-