org.omegahat.Environment.DataStructures
Class numeric
java.lang.Object
|
+--org.omegahat.Environment.DataStructures.vector
|
+--org.omegahat.Environment.DataStructures.numeric
- All Implemented Interfaces:
- Addable, AssignableSubset, Divisable, MathOperable, Multiplicable, java.io.Serializable, Subsettable, Subtractable
- public class numeric
- extends vector
- implements Addable, Subtractable, Multiplicable, Divisable, Subsettable, AssignableSubset
S-like array of primitive doubles, with methods
to perform basic types.
- See Also:
Variable.,
org.omegahat.Environment.ObjectDataStructures.numeric., Serialized Form
|
Field Summary |
protected double[] |
_data
The array containing the values. |
| Fields inherited from class org.omegahat.Environment.DataStructures.vector |
NA_PATTERN |
|
Method Summary |
java.lang.Object |
addValue(java.lang.Object rhs,
boolean inPlace)
Adds the given object to this elements of this
object in a manner consistent with the class of
rhs. |
java.lang.Object |
assignSubset(java.lang.Object index,
java.lang.Object value)
|
java.lang.Object |
data()
|
java.lang.Object |
data(double d)
|
java.lang.Object |
data(double[] d)
|
java.lang.Object |
data(int len)
|
java.lang.Object |
divideValue(java.lang.Object rhs,
boolean inPlace)
|
double |
getElement(int i)
|
int |
length()
|
protected java.lang.Object |
mathOperation(numeric rhs,
boolean inPlace,
int operator)
|
protected java.lang.Object |
mathOperation(java.lang.Object rhs,
boolean inPlace,
int operator)
|
double |
max()
Compute the maximum of the vector. |
double |
min()
Compute the minimum of the vector. |
java.lang.Object |
multiplyValue(java.lang.Object rhs,
boolean inPlace)
|
int |
setData(double[] d)
Use the specified array as the data
for this object without copying
it. |
int |
setData(double[] d,
boolean copy)
Sets the data elements using the values
in the specified array, copying the entire
array structure or not depending on the value
of copy |
numeric |
sort(boolean copy)
A sort operation, that optionally copies
the data before sorting since the sort is done in-line. |
java.lang.Object |
subset(List index,
boolean keepStructure)
|
java.lang.Object |
subset(java.lang.Number index,
boolean keepStructure)
|
java.lang.Object |
subset(java.lang.Object index,
boolean keepStructure)
|
java.lang.Object |
subtractValue(java.lang.Object rhs,
boolean inPlace)
|
java.lang.String |
toString()
|
static double |
valueOf(java.lang.String s)
|
| Methods inherited from class org.omegahat.Environment.DataStructures.vector |
asArray, data, data, data, element, exp, isNA, isNA, minus, multiply, plus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_data
protected double[] _data
- The array containing the values.
numeric
public numeric()
numeric
public numeric(int length)
numeric
public numeric(double[] d)
numeric
public numeric(double[] d,
boolean copy)
numeric
public numeric(double d)
numeric
public numeric(numeric d)
- Copying constructor.
numeric
public numeric(numeric d,
boolean copy)
data
public java.lang.Object data(double d)
data
public java.lang.Object data(double[] d)
data
public java.lang.Object data(int len)
- Overrides:
data in class vector
addValue
public java.lang.Object addValue(java.lang.Object rhs,
boolean inPlace)
- Adds the given object to this elements of this
object in a manner consistent with the class of
rhs. For example, if rhs
is another numeric, we add elementwise,
repeating elements as necessary if rhs
is shorter than this one.
If inPlace is false, the object is copied
before the addition is performed.
- Specified by:
addValue in interface Addable
subtractValue
public java.lang.Object subtractValue(java.lang.Object rhs,
boolean inPlace)
- Specified by:
subtractValue in interface Subtractable
multiplyValue
public java.lang.Object multiplyValue(java.lang.Object rhs,
boolean inPlace)
- Specified by:
multiplyValue in interface Multiplicable
divideValue
public java.lang.Object divideValue(java.lang.Object rhs,
boolean inPlace)
- Specified by:
divideValue in interface Divisable
mathOperation
protected java.lang.Object mathOperation(java.lang.Object rhs,
boolean inPlace,
int operator)
mathOperation
protected java.lang.Object mathOperation(numeric rhs,
boolean inPlace,
int operator)
data
public java.lang.Object data()
- Overrides:
data in class vector
length
public int length()
- Overrides:
length in class vector
valueOf
public static double valueOf(java.lang.String s)
throws java.io.IOException
getElement
public double getElement(int i)
setData
public int setData(double[] d)
- Use the specified array as the data
for this object without copying
it.
- Parameters:
d - array of values used directly
as the values of this vector.
setData
public int setData(double[] d,
boolean copy)
- Sets the data elements using the values
in the specified array, copying the entire
array structure or not depending on the value
of
copy
- Parameters:
d - the array to be used as the data for
this object or to be copied.copy - whether to copy the array before
caching the reference to it.
sort
public numeric sort(boolean copy)
- A sort operation, that optionally copies
the data before sorting since the sort is done in-line.
min
public double min()
- Compute the minimum of the vector.
This does not sort the data.
max
public double max()
- Compute the maximum of the vector.
This does not sort the data.
subset
public java.lang.Object subset(java.lang.Object index,
boolean keepStructure)
throws java.lang.Throwable
- Specified by:
subset in interface Subsettable
subset
public java.lang.Object subset(java.lang.Number index,
boolean keepStructure)
subset
public java.lang.Object subset(List index,
boolean keepStructure)
throws java.lang.Throwable
assignSubset
public java.lang.Object assignSubset(java.lang.Object index,
java.lang.Object value)
- Specified by:
assignSubset in interface AssignableSubset
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object