Package hec.heclib.util
Class HecDoubleArray
java.lang.Object
hec.heclib.util.HecDoubleArray
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHecDoubleArray(double[] doubleArray) HecDoubleArray(int numberElements) HecDoubleArray(HecDoubleArray hecDoubleArray) -
Method Summary
Modifier and TypeMethodDescriptionabsoluteMaximum(intContainer elementNumber) absoluteMinimum(intContainer elementNumber) average()element(int index) intintestimatePrecision(int sigDigits) intdouble[]Returns a double[] array containing the datadouble[]getDoubleArray(int startElement, int lastElement) Returns a double[] array containing the dataintindex(double val, boolean ascending) Search the array to determine if the provided value is in the array Returns the element number of that value, or -1 if not found.intbooleanbooleanisDefined(int elementNumber) booleanisDefined(intContainer elementNumber) intmaximum()maximum(intContainer elementNumber) merge(HecDoubleArray remote) Returns a new HecDoubleArray with local and passed in arrays merge Does not change local array! Copies HecDoubles Assumes that both arrays are sorted in increasing orderminimum()minimum(intContainer elementNumber) intintintintintresize(int numberElements) Resize the array.intresize(int numberElements, int beginningElement) Resize the array.intresize(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.voidset(double[] values) voidset(int index, double value) voidvoidset(HecDoubleArray hecDoubleArray) voidintsetPrecision(int precision) intsetSignificantDigits(int sigDigits) intsetSize(int numberElements) voidstring(int elementNumber) string(int elementNumber, boolean printCommas) sum()toString()value(int elementNumber)
-
Constructor Details
-
HecDoubleArray
public HecDoubleArray() -
HecDoubleArray
public HecDoubleArray(int numberElements) -
HecDoubleArray
public HecDoubleArray(double[] doubleArray) -
HecDoubleArray
-
-
Method Details
-
value
-
isDefined
public boolean isDefined() -
isDefined
public boolean isDefined(int elementNumber) -
isDefined
-
numberElements
public int numberElements() -
element
-
string
-
string
-
estimatePrecision
public int estimatePrecision() -
estimatePrecision
public int estimatePrecision(int sigDigits) -
set
-
set
-
set
-
set
public void set(int index, double value) -
set
public void set(double[] values) -
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. -
setPrecision
public int setPrecision(int precision) -
setSignificantDigits
public int setSignificantDigits(int sigDigits) -
setUndefined
public void setUndefined() -
getDoubleArray
public double[] getDoubleArray()Returns a double[] array containing the data -
getDoubleArray
public double[] getDoubleArray(int startElement, int lastElement) Returns a double[] array containing the data -
precision
public int precision() -
absoluteMaximum
-
absoluteMaximum
-
firstDefined
public int firstDefined() -
lastDefined
public int lastDefined() -
maximum
-
maximum
-
minimum
-
minimum
-
average
-
sum
-
absoluteMinimum
-
absoluteMinimum
-
absoluteSum
-
absoluteAverage
-
numberValidElements
public int numberValidElements() -
numberMissingElements
public int numberMissingElements() -
toString
-
toString
-
merge
Returns a new HecDoubleArray with local and passed in arrays merge Does not change local array! Copies HecDoubles Assumes that both arrays are sorted in increasing order -
index
public int index(double val, boolean ascending) Search the array to determine if the provided value is in the array Returns the element number of that value, or -1 if not found. This is a quicker search if you know the values are in ascending order. -
index
-