public class FloatTable
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Modified by: Joseph A. Huwaldt
Modifier and Type | Field and Description |
---|---|
protected float[][] |
breakpoints
The breakpoints (independent variables) for each dimension of this table.
|
protected FloatArrayNDim |
depData
The n dimensional dependent data table.
|
protected static int |
HI |
protected int[] |
idxStack
Stack of HI/LO independent array indexes used to indicate which value to
read from the n-dimensional data table.
|
protected float[] |
indep |
protected java.lang.String[] |
independentNames
The name of each independent variable (breakpoint table).
|
protected int[][] |
indPos |
protected float[][] |
indValues |
protected static int |
LO |
protected int |
numDims
The number of dimensions of the data in this table.
|
protected int[] |
pos |
protected java.lang.String |
tblName
The name of this data table.
|
Modifier | Constructor and Description |
---|---|
protected |
FloatTable()
Do not allow the default constructor to be used for instantiation.
|
|
FloatTable(java.lang.String name,
java.lang.String[] indepNames,
float[][] brkpoints,
FloatArrayNDim dData)
Create a FloatTable object with the given name and an arbitrary number
of dimensions.
|
|
FloatTable(java.lang.String tableName,
java.lang.String[] indepNames,
float[] indep1,
float[] indep2,
float[][] dependent)
Creates a 2D FloatTable object using the given Java arrays
as independent and dependent variables.
|
|
FloatTable(java.lang.String tableName,
java.lang.String[] indepNames,
float[] indep1,
float[] indep2,
float[] indep3,
float[][][] dependent)
Creates a 3D FloatTable object using the given Java arrays
as independent and dependent variables.
|
|
FloatTable(java.lang.String tableName,
java.lang.String indepName,
float[] indep,
float[] dependent)
Creates a 1D FloatTable object using the given Java arrays
as independent and dependent variables.
|
Modifier and Type | Method and Description |
---|---|
void |
addAllNotes(java.lang.String[] noteArr)
Add all the notes in an array of Strings to the list of
notes associated with this table.
|
void |
addNote(java.lang.String note)
Add a new note String to the list of notes associated with
this table.
|
void |
clearNotes()
Removes all notes associated with this table.
|
java.lang.Object |
clone()
Make a copy of this function table.
|
int |
dimensions()
Returns the number of dimensions (the number of independent
variables) contained in this table.
|
float |
get(int position)
Get the value of a particular element in the table.
|
float |
get(int[] position)
Get the value of a particular element in the table.
|
FloatArrayNDim |
getAll()
Return all the dependent data in the table.
|
java.lang.String[] |
getAllNotes()
Get all the note Strings associated with this table
and return them as an array of Strings.
|
float |
getBreakpoint(int dim,
int index)
Get the value of a particular table breakpoint.
|
float[] |
getBreakpoints(int dim)
Returns the array of breakpoints corresponding to the
specified dimension (independent variable).
|
java.lang.String |
getIndepName(int dim)
Returns the name of the specified independent
variable as a String object.
|
java.lang.String[] |
getIndepNames()
Returns the names of the independent variables
as an array of String objects.
|
java.lang.String |
getNote(int index)
Get a specified note String from the list of notes
associated with this table.
|
int |
getNumBreakpoints(int dim)
Returns the number of breakpoints in a specified dimension.
|
java.lang.String |
getTableName()
Returns the table name as a String.
|
static float |
interp(float ind1,
float dep1,
float ind2,
float dep2,
float indep)
Linear interpolation routine.
|
float |
lookup(float independent)
Look up a value in a 1D table.
|
float |
lookup(float[] independents)
Look up a value in the table.
|
int |
numberOfNotes()
Returns the number of notes associated with this table.
|
java.lang.String |
removeNote(int index)
Remove a specified note String from the list of notes
associated with this table.
|
void |
set(int[] position,
float value)
Set the value of a particular element in the table.
|
void |
setBreakpoint(int dim,
int index,
float value)
Set the value of a particular table breakpoint.
|
void |
setBreakpoints(int dim,
float[] newBreakpoints)
Sets the array of breakpoints corresponding to the
specified dimension (independent variable).
|
void |
setIndepName(int dim,
java.lang.String name)
Set the name of the specified independent variable.
|
void |
setIndepNames(java.lang.String[] names)
Sets the names of the independent variables
to those in the given array.
|
void |
setTableName(java.lang.String name)
Sets this table's name to the specified String.
|
int |
size()
Returns the total number of elements in the dependent data
for this table.
|
java.lang.String |
toString()
Output the name of the table and the names of it's
independent variables.
|
protected java.lang.String tblName
protected int numDims
protected float[][] breakpoints
protected java.lang.String[] independentNames
protected FloatArrayNDim depData
protected transient float[] indep
protected transient float[][] indValues
protected transient int[][] indPos
protected transient int[] pos
protected transient int[] idxStack
protected static final int LO
protected static final int HI
protected FloatTable()
public FloatTable(java.lang.String name, java.lang.String[] indepNames, float[][] brkpoints, FloatArrayNDim dData)
name
- The name of the new table.indepNames
- An array of names for the independent variables.brkpoints
- An array of breakpoint arrays for each independent variable.dData
- An n-dimensional array of dependent data for this table.
Pass null to have an empty table created.public FloatTable(java.lang.String tableName, java.lang.String indepName, float[] indep, float[] dependent)
tableName
- The name to be given to this table.indepName
- The name of the independent variable.indep
- The array of independent variable
breakpoints.dependent
- The array of dependent variable values. May pass null
to create an table filled with zero values.public FloatTable(java.lang.String tableName, java.lang.String[] indepNames, float[] indep1, float[] indep2, float[][] dependent)
tableName
- The name to be given to this table.indepNames
- List of names of independent variables.indep1
- The array of 1st independent variable
breakpoints.indep2
- The array of 2nd independent variable
breakpoints.dependent
- The array of dependent variable values. May pass
null to create a table filled with zero values.public FloatTable(java.lang.String tableName, java.lang.String[] indepNames, float[] indep1, float[] indep2, float[] indep3, float[][][] dependent)
tableName
- The name to be given to this table.indepNames
- List of names of independent variables.indep1
- The array of 1st independent variable
breakpoints.indep2
- The array of 2nd independent variable
breakpoints.indep3
- The array of 3rd independent variable
breakpoints.dependent
- The array of dependent variable values. May pass
null to create a table filled with zero values.public int dimensions()
public int size()
public void setTableName(java.lang.String name)
name
- The new name to give this table.public java.lang.String getTableName()
public void setIndepNames(java.lang.String[] names)
names
- The array of new names for the table's independent
variables.public java.lang.String[] getIndepNames()
public void setIndepName(int dim, java.lang.String name)
dim
- The index of the independent variable to
set the name of. A value of 0 indicates
the independent that varies the least, a
value of dimensions()-1 indicates the
independent that varies the most.name
- The new name to give the specified independent
variable.public java.lang.String getIndepName(int dim)
dim
- The index of the independent variable to
return the name of. A value of 0 indicates
the independent that varies the least, a
value of dimensions()-1 indicates the
independent that varies the most.public int getNumBreakpoints(int dim)
dim
- The index of the independent variable to
return the number of breakpoints for. A value of
0 indicates the independent that varies the least,
a value of dimensions()-1 indicates the
independent that varies the most.public float[] getBreakpoints(int dim)
dim
- The index of the independent variable to
return the breakpoints for. A value of 0 indicates
the independent that varies the least, a
value of dimensions()-1 indicates the
independent that varies the most.public float getBreakpoint(int dim, int index)
dim
- The index of the independent variable or
dimension to return. A value of
0 indicates the independent that varies the least,
a value of dimensions()-1 indicates the
independent that varies the most.index
- Index of the breakpoint to return in the specified
dimension.public void setBreakpoints(int dim, float[] newBreakpoints)
dim
- The index of the independent variable to
set the breakpoints for. A value of 0 indicates
the independent that varies the least, a
value of dimensions()-1 indicates the
independent that varies the most.newBreakpoints
- An array of breakpoints for the
specified dimension.public void setBreakpoint(int dim, int index, float value)
dim
- The index of the independent variable or
dimension to change a breakpoint for. A value of
0 indicates the independent that varies the least,
a value of dimensions()-1 indicates the
independent that varies the most.index
- Index of the breakpoint to modify in the specified
dimension.value
- The new value of the specified breakpoint.public void set(int[] position, float value)
position
- The index into the table of the value to be
set. For example, for a 3D table the position could be
{ 0, 3, 2 }. The 1st index is for the independent that
varies the least, the last for the one that varies the
most.value
- The value to be stored in the table.public float get(int[] position)
position
- The index into the table of the value to be
retrieved. For example, for a 3D table the position could be
{ 0, 3, 2 }. The 1st index is for the independent that
varies the least, the last for the one that varies the
most.public float get(int position)
position
- The index into the 1D table of the value to be
retrieved.public FloatArrayNDim getAll()
public float lookup(float[] independents)
Look up a value in the table. Linear interpolation is used to find values between the breakpoints contained in the table.
WARNING: If the independent values supplied exceed the table limits, the value returned will be extrapolated from the last two entries in the table.
independents
- The list of n-dimensional independent variables to use
for the table look up.public float lookup(float independent)
Look up a value in a 1D table. Linear interpolation is used to find value between the breakpoints contained in the table. This is a special version of lookup() that works only with a 1-dimensional table (1 independent variable). This version is provided for increased performance in this special (but common) case.
WARNING: If the independent value supplied exceeds the table limits, the value returned will be extrapolated from the table.
independent
- The independent variable to use for the table look up.public static float interp(float ind1, float dep1, float ind2, float dep2, float indep)
ind1
- Low independent value.dep1
- Low dependent value.ind2
- High independent value.dep2
- High dependent value.indep
- Independent value we want to interpolate for.public int numberOfNotes()
public void addNote(java.lang.String note)
note
- The new note to add to this table.public void addAllNotes(java.lang.String[] noteArr)
noteArr
- The array of new notes to add to this table.public java.lang.String getNote(int index)
index
- The index of the note to retrieve.java.lang.ArrayIndexOutOfBoundsException
- if the specified
index is out of bounds or if there are no notes
associated with this table.public java.lang.String[] getAllNotes()
public java.lang.String removeNote(int index)
index
- The index of the note to remove.java.lang.ArrayIndexOutOfBoundsException
- if the specified
index is out of bounds or if there are no notes
associated with this table.public void clearNotes()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object