org.omegahat.DataStructures.Data
Class FactorVariable
java.lang.Object
|
+--org.omegahat.DataStructures.Data.AbstractVariable
|
+--org.omegahat.DataStructures.Data.FactorVariable
- All Implemented Interfaces:
- DataVariableInt, FactorInt, java.io.Serializable, VariableInt
- public class FactorVariable
- extends AbstractVariable
- implements FactorInt, java.io.Serializable
An unordered factor variable that has a set of levels
and observed values that are indices into this set
to identify that record's level/value.
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
levels
protected FactorLevelSetInt levels
levelIndices
protected int[] levelIndices
values
protected java.lang.Object[] values
FactorVariable
public FactorVariable()
FactorVariable
public FactorVariable(int num)
FactorVariable
public FactorVariable(java.lang.Object[] str)
FactorVariable
public FactorVariable(java.lang.Object[] str,
int num)
FactorVariable
public FactorVariable(java.lang.Object[] str,
int num,
java.util.Hashtable metaData)
FactorVariable
public FactorVariable(FactorVariable var)
labels
public java.lang.Object[] labels()
levels
public FactorLevelSetInt levels()
- Description copied from interface:
FactorInt
- Return an element containing the different levels used by this
variable.
- Specified by:
levels in interface FactorInt
levels
public FactorLevelSetInt levels(FactorLevelSetInt lev)
levels
public FactorLevelSetInt levels(java.lang.String[] els)
levels
public FactorLevelSetInt levels(java.lang.Object value)
levels
public FactorLevelSetInt levels(java.util.Vector v)
numLevels
public int numLevels()
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
getSize
public int getSize()
values
public java.lang.Object[] values()
- Specified by:
values in interface FactorInt
computeValues
protected java.lang.Object[] computeValues()
value
public java.lang.Object value(int i)
asArray
public java.lang.Object asArray()
asArrayCopy
public java.lang.Object asArrayCopy()
values
public VariableInt values(int[] ind)
- Description copied from interface:
VariableInt
- Get a
Variable consisting of the specified elements.
- Specified by:
values in interface VariableInt- Overrides:
values in class AbstractVariable
toStringArray
public java.lang.Object[] toStringArray()
add
public void add(java.lang.Object value,
int which)
- Specified by:
add in interface VariableInt- Overrides:
add in class AbstractVariable
add
public void add(double value,
int which)
- Specified by:
add in interface VariableInt- Overrides:
add in class AbstractVariable
add
public void add(int value,
int which)
numObservations
public long numObservations()
- Description copied from interface:
VariableInt
- Return the length or number of records in this
VariableInt.
- Specified by:
numObservations in interface VariableInt
getValues
public double[] getValues()
indicesForLevel
public long[] indicesForLevel(java.lang.Object level)
- Description copied from interface:
FactorInt
- Get the indices of the observations associated with the given
level.
- Specified by:
indicesForLevel in interface FactorInt