JavaGrinders
Class Variable

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector
              extended by JavaGrinders.Variable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess
Direct Known Subclasses:
BooleanVariable, CaptureVariable, NumberVariable, StrVariable, TimeVariable

public class Variable
extends java.util.Vector
implements java.lang.Cloneable

handles things that a general variable should do or know about. It is based on the Vector class. This class can query and set the number of entries in the array, find selected rows for analysis using a variety of criteria, list the content, report descriptive statistics, identify how many unique IDs there are, compares these with other IDs, and reports them, etc.

See Also:
Serialized Form

Field Summary
 java.lang.Object[] allData
           
 boolean autoExtracted
           
 java.text.DecimalFormat df
           
 Descriptives itsDescriptives
           
 java.awt.Color itsHighlitedColor
           
 java.awt.Color itsLineColor
           
 java.awt.Color itsLocationColor
           
 RHRandomNumberGenerator rand
           
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Variable(java.lang.String varName, VariableOrganizer theOwner)
          Standard constructor for the root Variable class using a VariableOrganizer
 
Method Summary
 void addValue(java.lang.Object anObject)
          appends an Object to the end of the Variable
 void append(java.lang.Object[] theData)
          appends the variable to the end of the variable
 void appendVariable(Variable aVar)
          appends the variable to the end of the variable
 Matrix asJAMAMatrix()
          returns a matrix for the variables in the variableorganizer which have been selected as dependent variables (i.e., VariableDesignRole.Y) and which are ordinal or nominal
 VariableOrganizer asVariableOrganizer()
          returns the variable as a variable organizer filled with this variable
 boolean checkMatchingRows(ContingencyTable aMat)
          examine whether this variables has the same number of rows as the provided ContingencyTable
 boolean checkMinUseRows(int minRows)
          examines whether a minimum number rows is selected
 void checkNumberIDs(int compareTo)
          checks whether there is a given number of distinct IDs present in the currently selected set of rows
 void checkSameIDs(Variable theOtherVariable)
          checks whether two variables have identical sets of distinct IDs in the currently selected set of rows
 boolean checkSameSelectRows(Variable theVar)
          examines whether the same rows are selected as in another variable
 boolean checkSameSelectRows(VariableOrganizer theVarOrganizer)
          examines whether the same rows are selected as in another variable
 boolean checkSameUseRows(Variable theVar)
          examines whether the same rows are selected and not missing as in another variable
 boolean checkSameUseRows(VariableOrganizer theVarOrganizer)
          examines whether the same rows are selected and not missing as in another variable
 boolean checkValidRowRange(int row)
          checks whether a given row is within a valid range
 java.lang.Object clone()
          clone the object
 Variable cloneSelectedRowsOnly()
          returns a clone of the Variable with selected rows only
 void cloneVariableFrom(Variable aVar)
          fills the variable as a clone of the variable
 void combineSelectedWithSavedSelectedRows()
          invert select rows
 Descriptives copyDescriptives()
          returns the descriptives for the variable
 void copySelectStateFrom(Variable aVar)
          sets the select flag for all rows based on select state of another variable
 void customColorSelectedRows(java.awt.Color aColor, boolean addToPreviousSet)
          sets a custom colors for all selected rows
 void deleteAllRows()
          delete all rows from the Variable
 void deleteDuplicateRows()
          sets the select flag for all duplicate rows
 void deleteMissingRows()
          deletes all missing rows
 void deleteNonSelectedRows()
          delete all non-selected rows
 void deleteRow(int row)
          delete a row from the Variable
 void deleteSelectedRows()
          deletes all selected rows
 void deselectAllRows()
          sets the select flag for all rows to false
 Variable fill(double[] theData)
          fills the variable with individual datavalues from a double array
 Variable fill(int[] theData)
          fills the variable with individual datavalues from a double array
 void fill(int nRows, double aValue)
          fills the variable with a constant
 void fill(int nRows, java.lang.Object aValue)
          fills the variable with the given value in every row.
 Variable fill(java.lang.Object[] theData)
          fills the variable with the given value in every row.
 Variable fill(java.lang.Object[] theData, boolean ascending)
          fills the variable with the given value in every row.
 void fillDescriptives()
          fills the descriptive statistics for the variable, at the root level only a check for valid data points is performed
 void fillDescriptives(java.lang.Double hypVal)
          fills the descriptive statistics for the variable, at the root level only a check for valid data points is performed
 void fillIDs()
          fills a TreeMap with different values found in the variable using the currently selected set of rows
 void fillWithParser(DataFileParser aParser, int varNum)
          fills the variable with individual datavalues read from a textfile using a DataFileParser object.
 void fillWithParser(DataFileParser aParser, int varNum, boolean firstRowAsLabels)
          fills the variable with individual datavalues read from a textfile using a DataFileParser object.
 void fillWithVariable(Variable aVar)
          fills the variable as a clone of the variable
 int findFirstValidRow()
          returns the first selected row of the variable
 int findLastValidRow()
          returns the last selected row of the variable
 int findNextNonMissingRow(int startSearchAt)
          returns the next selected row after a given row
 int findNextValidRow(int startSearchAt)
          returns the next selected row after a given row
 int findNextValue(int startSearchAt, java.lang.Object aValue)
          returns the next selected row after a given row
 int findPreviousValidRow(int startSearchAt)
          returns the next lower selected row before a given row
 int getabasedintValue(int row)
          returns the instance of char stored at a given row of the Vector and converts it into an integer starting with 0 at a char of 'a'
 int getAbasedintValue(int row)
          returns the instance of char stored at a given row of the Vector and converts it into an integer starting with 0 at a char of 'A'
 java.lang.Object[] getArray(boolean validRows)
          returns an array of double values of the Vector
 boolean getbooleanValue(int row)
          returns the value stored at a given row of the Vector as a boolean
 char getcharValue(int row)
          returns the instance of char stored at a given row in the Vector
 java.util.TreeMap getCombinedIDs(Variable theOtherVariable)
          returns a TreeMap containing all different values found in either this variable using the currently selected set of rows or in the selected rows of a second variable
 ContingencyTable getCrossTabulation(Variable theXVariable, boolean sameIDs, boolean includeDiagonal)
          returns a crosstabulation of values for two variables in form of a matrix
 ContingencyTable getCrossTabulation(Variable theXVariable, java.util.TreeMap xHash, java.util.TreeMap yHash, boolean includeDiagonal)
          returns a crosstabulation of values for two variables in form of a matrix
 java.awt.Color getCustomColorRow(int row)
          returns the custom color for a given row
 Descriptives getDescriptives()
          returns the descriptives for the variable
 double[] getdoubleArray(boolean validRows)
          returns an array of double values of the Vector
 double getdoubleValue(int row)
          returns the value stored at a given row of the Vector as a double
 float getfloatValue(int row)
          returns the value stored at a given row of the Vector as a float
 int[] getFrequencies()
          returns the frequencies for different instances of the variable using the currently selected set of rows up to the specified number of maxInstances
 java.awt.Color getHighliteColor()
          returns the highlite color for the animal
 boolean getHighlitedRow(int row)
          returns whether a given row is currently highlited.
 java.util.TreeMap getIDMap()
          returns a TreeMap containing all different values found in the variable using the currently selected set of rows
 java.lang.Object[] getIDs()
          returns a TreeMap containing all different values found in the variable using the currently selected set of rows
 java.lang.String getIDString(int theIndex)
          returns a single entry for a key in the TreeMap as a String
 java.lang.String[] getIDStrings()
          returns the keys in the TreeMap as strings
 InteractionTable getInteractions(Variable theXVariable)
          returns a crosstabulation of values for two variables in form of an interaction matrix
 int getintValue(int row)
          returns the value stored at a given row of the Vector as an int
 double getJaccard(Variable aVar)
          returns the Manhattan proximity measure to another variable
 java.awt.Color getLineColor()
          returns the line color for the variable
 java.awt.Color getLocationColor()
          returns the location color for the variable
 long getlongValue(int row)
          returns the instance of long stored at a given row in the Vector
 double getManhattan(Variable aVar)
          returns the Manhattan proximity measure to another variable
 boolean getMissingRow(int row)
          returns whether a given row is currently missing.
 java.lang.String getName()
          returns the name of the Variable
 int getNIDs()
          returns the number of different values present in the currently selected set of rows
 int getNMissingRows()
          returns the number of missing rows in the currently selected set
 java.lang.String getNotes()
          returns the Notes of the Variable
 int getNRows()
          returns the number of rows in the Variable
 int getNSelectRows()
          returns the number of currently selected rows for the variable
 int getNUseRows()
          returns the number of usable rows in the currently selected set
 int getNValidRows()
          returns the number of currently selected rows for the variable which do not have missing values
 VariableOrganizer getOrganizer()
          returns the VariableOrganizer for the Variable
 double getProximity(Variable aVar)
          returns the proximity measure to another variable
 double getProximity(Variable aVar, int How)
          returns the proximity measure to another variable
 java.lang.Object getRandomValue()
          returns the object stored at a randomly selected row of the Vector
 java.util.Vector getRowOrder()
          returns the Notes of the Variable
 double getRowOrderRow(int row)
          returns whether a given row is currently selected.
 boolean getSelectRow(int row)
          returns whether a given row is currently selected.
 double getSquEuclidian(Variable aVar)
          returns the Euclidian proximity measure to another variable
 java.lang.String[] getStringArray(boolean selected)
          returns the object stored at a given row of the Vector as a String
 java.lang.String getStringValue(int row)
          returns the object stored at a given row of the Vector as a String
 ContingencyTable getTransitions()
          returns the transitions among consecutive values in form of a matrix
 boolean getUseRow(int row)
          returns whether a given row can be used.
 java.lang.Object getValue(int row)
          returns the object stored at a given row of the Vector
 int getVariableDesignRole()
          returns the variable design role
 java.lang.String getVariableDesignRoleString()
          returns the variable design role as a character string
 int getVariableFormat()
          returns the variable format
 int getVariableType()
          returns the variable type
 void highliteSelectedRows()
          highlites the selected rows only
 void highliteSelectedRows(boolean addToPreviousSet)
          highlites all selected rows
 void invalidDescriptives()
          descriptive stats need to be updated
 void invertSelectedRows()
          invert select rows
 boolean isAngleType()
          returns whether the variable is of type ANGLES
 boolean isContinuousType()
          returns whether the variable is of type CONTINUOUS
 boolean isLocationType()
          returns whether the variable is of type LOCATIONS
 boolean isLocked()
          returns whether a variable is locked for further selections, modifications, etc.
 boolean isNominalType()
          returns whether the variable is of type NOMINAL
 boolean isOrdinalType()
          returns whether the variable is of type ORDINAL
 boolean isXVariable()
          is the variable selected as an independent variable
 boolean isYVariable()
          is the variable selected as a dependent variable
 void listDescriptives()
          lists the descriptive statistics for the variable using the currently selected set of rows
 void listDescriptives(java.lang.Double Mean)
          lists the descriptive statistics for the variable using the currently selected set of rows
 void listGroupDescriptives(Variable theXVariable)
          lists the descriptives for the groups identified by X
 void listGroupDescriptivesNoDia(Variable theXVariable)
          lists the descriptives for the groups identified by X
 void listRowOrder(int startLine, int endLine, boolean selectedOnly)
          lists data values for a range of rows
 void listRows()
          lists all data values in the variable
 void listRows(boolean selectedOnly)
          lists all data values in the variable
 void listRows(int startLine, int endLine, boolean selectedOnly)
          lists data values for a range of rows
 void listSelectedRows()
          lists data values for all selected rows in the variable
 void listSelectState()
          lists for each row whether it is selected or not
 void listSelectState(int startLine, int endLine)
          lists for a range of rows whether it is selected or not
 void listUseRows()
          lists data values for all selected rows in the variable
 void makeNewDescriptives()
          create a new set of descriptives for the variable the object
 ContingencyTable makeTableSubSet(ContingencyTable aTable)
          returns a subset of row data values for the ContingencyTable as a ContingencyTable.
 boolean matchedIDs(java.util.TreeMap theOtherIDs)
          returns whether there is a value in this variable that is not present in a given TreeMap
 void replaceSelectedRows(java.lang.Object whichValue)
          sets the select flag for all rows based on select state of another variable
 void restoreSelectedRows()
          restores the select flag for all rows from a previously saved set
 void restrictToMatchingUseRows(Variable aVar)
          restricts the select flag to those rows that are usable in both variables
 void restrictToMatchingUseRows(VariableOrganizer aVarOrg)
          restricts the use flag to those rows that are usable in the variables as well as in the Organizer
 void restrictToValidRowsOnly()
          sets the select flag for all valid (non-missing) rows to true
 void reverseRows(int a1, int a2, boolean checkForOrganizer)
          reverses the values of two given rows
 void saveSelectedRows()
          saves the select flag for all rows
 void selectAllRows()
          sets the select flag for all rows to true
 void selectDuplicateRows()
          sets the select flag for all duplicate rows
 void selectRows(int start, int end)
          sets the select flag for all rows to true
 void selectUseRows()
          restricts the select flag to those rows that are usable in both variables
 void selectValue(java.lang.Object whichValue, boolean fromPrevSelected)
          selects rows that match a given object from the currently selected set of rows
 void setAnglesType()
          sets the variable to type ANGLES
 void setCustomColorRow(int row, java.awt.Color aColor)
          sets the custom color for a given row
 void setFormula(java.lang.String aFormula)
          sets a formula for a given vector
 void setHighliteColor(java.awt.Color aColor)
          sets a highlite color for the animal
 void setHighlitedRow(int row, boolean highlite)
          sets the highlite flag for a given row
 void setLineColor(java.awt.Color aColor)
          sets a line color for the animal
 void setLocationColor(java.awt.Color aColor)
          sets a location color for the animal
 void setLocationsType()
          sets the variable to type LOCATIONS
 void setLock(boolean lock)
          sets whether a variable is locked for further selections, modifications, etc.
 void setMissingRow(int row, boolean missing)
          sets the missing flag for a given row
 void setName(java.lang.String varName)
          sets the name of the variable to the String provided
 void setNominalType()
          sets the variable to type NOMINAL
 void setNotes(java.lang.String varNotes)
          sets the notes for the variable
 void setNRows(int rows)
          sets the number of rows for the Variable
 void setOrdinalType()
          sets the variable to type ORDINAL
 void setOrganizer(VariableOrganizer theOrganizer)
          sets a VariableOrganizer for the Variable
 void setRowOrder(java.util.Vector rowOrder)
          sets the rowOrder for the variable
 void setRowOrderRow(int row, double rowNum)
          sets the number of rows for the Variable
 void setSelectRow(int row, boolean select)
          sets the select flag for a given row
 void setSelectRows(java.lang.Object aVal)
          sets all selected rows to a particular value
 void setSelectRowsToMissing()
          sets all selected rows to missing
 void setValue(int row, boolean aBoolean)
          sets a boolean value for a given row of the Vector
 void setValue(int row, char aChar)
          sets a char value for a given row in the Vector
 void setValue(int row, double aDouble)
          sets a double value for a given row of the Vector
 void setValue(int row, float aFloat)
          sets a float value for a given row of the Vector
 void setValue(int row, int aInt)
          sets an integer value for a given row of the Vector
 void setValue(int row, java.lang.Object anObject)
          sets a general object for a given row of the Vector
 void setVariableDesignRole(int vDesignRole)
          sets the design role for the variable
 void setVariableFormat(int vFormat)
          sets the variable format
 void setVariableType(int vType)
          sets the variable type
 Variable sort()
          sorts the values for all rows using a map of hashcodes
 Variable sort(boolean ascending)
          sorts the values for all rows using a map of hashcodes
 Variable sort2(boolean ascending)
          sorts the values for all rows using a map of hashcodes
 void updateRowOrder()
          updates the row order for the variable
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

rand

public RHRandomNumberGenerator rand

df

public java.text.DecimalFormat df

itsDescriptives

public Descriptives itsDescriptives

autoExtracted

public boolean autoExtracted

itsHighlitedColor

public java.awt.Color itsHighlitedColor

itsLocationColor

public java.awt.Color itsLocationColor

itsLineColor

public java.awt.Color itsLineColor

allData

public java.lang.Object[] allData
Constructor Detail

Variable

public Variable(java.lang.String varName,
                VariableOrganizer theOwner)
         throws java.lang.Exception
Standard constructor for the root Variable class using a VariableOrganizer

Parameters:
varName - assigns a name (String) to the variable
theOwner - an instance of VariableOrganizer class coordinates a set of variables with respect to number of data points available and the rows that are currently selected
Throws:
java.lang.Exception
Method Detail

cloneVariableFrom

public void cloneVariableFrom(Variable aVar)
fills the variable as a clone of the variable

Parameters:
aVar - the variable to clone

cloneSelectedRowsOnly

public Variable cloneSelectedRowsOnly()
                               throws java.lang.Exception
returns a clone of the Variable with selected rows only

Throws:
java.lang.Exception

clone

public java.lang.Object clone()
clone the object

Overrides:
clone in class java.util.Vector

setOrganizer

public void setOrganizer(VariableOrganizer theOrganizer)
sets a VariableOrganizer for the Variable

Parameters:
theOrganizer - an instance of VariableOrganizer class coordinates a set of variables with respect to number of data points available and the rows that are currently selected

getOrganizer

public VariableOrganizer getOrganizer()
returns the VariableOrganizer for the Variable


setLock

public void setLock(boolean lock)
sets whether a variable is locked for further selections, modifications, etc.

Parameters:
lock - marks whether a variable will be locked

isLocked

public boolean isLocked()
returns whether a variable is locked for further selections, modifications, etc.


setHighliteColor

public void setHighliteColor(java.awt.Color aColor)
sets a highlite color for the animal

Parameters:
aColor - the color to set

setLocationColor

public void setLocationColor(java.awt.Color aColor)
sets a location color for the animal

Parameters:
aColor - the color to set

setLineColor

public void setLineColor(java.awt.Color aColor)
sets a line color for the animal

Parameters:
aColor - the color to set

getHighliteColor

public java.awt.Color getHighliteColor()
returns the highlite color for the animal


getLocationColor

public java.awt.Color getLocationColor()
returns the location color for the variable


getLineColor

public java.awt.Color getLineColor()
returns the line color for the variable


setFormula

public void setFormula(java.lang.String aFormula)
                throws java.lang.Exception
sets a formula for a given vector

Parameters:
aFormula - the formula to use
Throws:
java.lang.Exception

setNominalType

public void setNominalType()
                    throws java.lang.Exception
sets the variable to type NOMINAL

Throws:
java.lang.Exception

setOrdinalType

public void setOrdinalType()
                    throws java.lang.Exception
sets the variable to type ORDINAL

Throws:
java.lang.Exception

setAnglesType

public void setAnglesType()
                   throws java.lang.Exception
sets the variable to type ANGLES

Throws:
java.lang.Exception

setLocationsType

public void setLocationsType()
                      throws java.lang.Exception
sets the variable to type LOCATIONS

Throws:
java.lang.Exception

setVariableType

public void setVariableType(int vType)
                     throws java.lang.Exception
sets the variable type

Parameters:
vType - the variable type to set
Throws:
java.lang.Exception

getVariableType

public int getVariableType()
returns the variable type


isNominalType

public boolean isNominalType()
returns whether the variable is of type NOMINAL


isOrdinalType

public boolean isOrdinalType()
returns whether the variable is of type ORDINAL


isContinuousType

public boolean isContinuousType()
returns whether the variable is of type CONTINUOUS


isLocationType

public boolean isLocationType()
returns whether the variable is of type LOCATIONS


isAngleType

public boolean isAngleType()
returns whether the variable is of type ANGLES


getVariableFormat

public int getVariableFormat()
returns the variable format


setVariableFormat

public void setVariableFormat(int vFormat)
                       throws java.lang.Exception
sets the variable format

Parameters:
vFormat - the variable format to set
Throws:
java.lang.Exception

isXVariable

public boolean isXVariable()
is the variable selected as an independent variable


isYVariable

public boolean isYVariable()
is the variable selected as a dependent variable


getVariableDesignRole

public int getVariableDesignRole()
returns the variable design role


getVariableDesignRoleString

public java.lang.String getVariableDesignRoleString()
returns the variable design role as a character string


setVariableDesignRole

public void setVariableDesignRole(int vDesignRole)
                           throws java.lang.Exception
sets the design role for the variable

Parameters:
vDesignRole - the variable design role
Throws:
java.lang.Exception

setName

public void setName(java.lang.String varName)
sets the name of the variable to the String provided

Parameters:
varName - new name of the Variable

getName

public java.lang.String getName()
returns the name of the Variable


setNotes

public void setNotes(java.lang.String varNotes)
sets the notes for the variable

Parameters:
varNotes - new Notes for the Variable

getNotes

public java.lang.String getNotes()
returns the Notes of the Variable


setRowOrder

public void setRowOrder(java.util.Vector rowOrder)
sets the rowOrder for the variable

Parameters:
rowOrder - the new rowOrder for the Variable

getRowOrder

public java.util.Vector getRowOrder()
returns the Notes of the Variable


setNRows

public void setNRows(int rows)
              throws java.lang.Exception
sets the number of rows for the Variable

Parameters:
rows - new number of rows for the variable
Throws:
java.lang.Exception

getNRows

public int getNRows()
returns the number of rows in the Variable


setValue

public void setValue(int row,
                     java.lang.Object anObject)
              throws java.lang.Exception
sets a general object for a given row of the Vector

Parameters:
row - marks the row in the vector for which to set the value
anObject - lists the Object to set for the row
Throws:
java.lang.Exception

setValue

public void setValue(int row,
                     int aInt)
              throws java.lang.Exception
sets an integer value for a given row of the Vector

Parameters:
row - marks the row in the vector for which to set the value
aInt - the int value to set for the row
Throws:
java.lang.Exception

setValue

public void setValue(int row,
                     float aFloat)
              throws java.lang.Exception
sets a float value for a given row of the Vector

Parameters:
row - marks the row in the vector for which to set the value
aFloat - the float value to set for the row
Throws:
java.lang.Exception

setValue

public void setValue(int row,
                     double aDouble)
              throws java.lang.Exception
sets a double value for a given row of the Vector

Parameters:
row - marks the row in the vector for which to set the value
aDouble - the double value to set for the row
Throws:
java.lang.Exception

setValue

public void setValue(int row,
                     char aChar)
              throws java.lang.Exception
sets a char value for a given row in the Vector

Parameters:
row - marks the row in the vector for which to set the char
aChar - the char to set for the row
Throws:
java.lang.Exception

setValue

public void setValue(int row,
                     boolean aBoolean)
              throws java.lang.Exception
sets a boolean value for a given row of the Vector

Parameters:
row - marks the row in the vector for which to set the value
aBoolean - lists the boolean value to set for the row
Throws:
java.lang.Exception

getValue

public java.lang.Object getValue(int row)
returns the object stored at a given row of the Vector

Parameters:
row - marks the row in the vector

getbooleanValue

public boolean getbooleanValue(int row)
returns the value stored at a given row of the Vector as a boolean

Parameters:
row - marks the row in the vector

getdoubleValue

public double getdoubleValue(int row)
                      throws java.lang.Exception
returns the value stored at a given row of the Vector as a double

Parameters:
row - marks the row in the vector
Throws:
java.lang.Exception

getStringValue

public java.lang.String getStringValue(int row)
returns the object stored at a given row of the Vector as a String

Parameters:
row - marks the row in the vector

getcharValue

public char getcharValue(int row)
returns the instance of char stored at a given row in the Vector

Parameters:
row - marks the row in the vector

getintValue

public int getintValue(int row)
                throws java.lang.Exception
returns the value stored at a given row of the Vector as an int

Parameters:
row - marks the row in the vector
Throws:
java.lang.Exception

getfloatValue

public float getfloatValue(int row)
returns the value stored at a given row of the Vector as a float

Parameters:
row - marks the row in the vector

getlongValue

public long getlongValue(int row)
returns the instance of long stored at a given row in the Vector

Parameters:
row - marks the row in the vector

getAbasedintValue

public int getAbasedintValue(int row)
returns the instance of char stored at a given row of the Vector and converts it into an integer starting with 0 at a char of 'A'

Parameters:
row - marks the row in the vector

getabasedintValue

public int getabasedintValue(int row)
returns the instance of char stored at a given row of the Vector and converts it into an integer starting with 0 at a char of 'a'

Parameters:
row - marks the row in the vector

getArray

public java.lang.Object[] getArray(boolean validRows)
                            throws java.lang.Exception
returns an array of double values of the Vector

Parameters:
validRows - marks whether only valid rows should be included
Throws:
java.lang.Exception

getdoubleArray

public double[] getdoubleArray(boolean validRows)
                        throws java.lang.Exception
returns an array of double values of the Vector

Parameters:
validRows - marks whether only valid rows should be included
Throws:
java.lang.Exception

getStringArray

public java.lang.String[] getStringArray(boolean selected)
                                  throws java.lang.Exception
returns the object stored at a given row of the Vector as a String

Parameters:
selected - marks whether only selected row should be included
Throws:
java.lang.Exception

fill

public void fill(int nRows,
                 java.lang.Object aValue)
          throws java.lang.Exception
fills the variable with the given value in every row. This code provides the basic funtionality for all sub-classes

Parameters:
nRows - the number of rows to fill
aValue - the value to place in every row
Throws:
java.lang.Exception

fill

public void fill(int nRows,
                 double aValue)
          throws java.lang.Exception
fills the variable with a constant

Parameters:
nRows - the number of rows to fill
aValue - the double value to place in every row
Throws:
java.lang.Exception

fill

public Variable fill(java.lang.Object[] theData,
                     boolean ascending)
              throws java.lang.Exception
fills the variable with the given value in every row. This code provides the basic funtionality for all sub-classes

Parameters:
theData - the values to place in the rows
ascending - from top to bottom?
Throws:
java.lang.Exception

fill

public Variable fill(java.lang.Object[] theData)
              throws java.lang.Exception
fills the variable with the given value in every row. This code provides the basic funtionality for all sub-classes

Parameters:
theData - the values to place in the rows
Throws:
java.lang.Exception

fill

public Variable fill(double[] theData)
              throws java.lang.Exception
fills the variable with individual datavalues from a double array

Parameters:
theData - a double array of data
Throws:
java.lang.Exception

fill

public Variable fill(int[] theData)
              throws java.lang.Exception
fills the variable with individual datavalues from a double array

Parameters:
theData - an int array of data
Throws:
java.lang.Exception

fillWithParser

public void fillWithParser(DataFileParser aParser,
                           int varNum,
                           boolean firstRowAsLabels)
                    throws java.lang.Exception
fills the variable with individual datavalues read from a textfile using a DataFileParser object. This code provides the basic funtionality for all sub-classes.

Parameters:
aParser - the DataFileParser that was used to read data values from a text file
varNum - marks the number of the column to be filled into the variable
firstRowAsLabels - whether the first row contains a variable label
Throws:
java.lang.Exception

fillWithParser

public void fillWithParser(DataFileParser aParser,
                           int varNum)
                    throws java.lang.Exception
fills the variable with individual datavalues read from a textfile using a DataFileParser object. This code provides the basic funtionality for all sub-classes.

Parameters:
aParser - the DataFileParser that was used to read data values from a text file
varNum - marks the number of the column to be filled into the variable
Throws:
java.lang.Exception

fillWithVariable

public void fillWithVariable(Variable aVar)
fills the variable as a clone of the variable

Parameters:
aVar - the variable to clone

append

public void append(java.lang.Object[] theData)
            throws java.lang.Exception
appends the variable to the end of the variable

Parameters:
theData - the array of Objects to add to the end of the variable
Throws:
java.lang.Exception

appendVariable

public void appendVariable(Variable aVar)
appends the variable to the end of the variable

Parameters:
aVar - the variable to clone

addValue

public void addValue(java.lang.Object anObject)
              throws java.lang.Exception
appends an Object to the end of the Variable

Parameters:
anObject - the object to add
Throws:
java.lang.Exception

getRandomValue

public java.lang.Object getRandomValue()
returns the object stored at a randomly selected row of the Vector


getNSelectRows

public int getNSelectRows()
                   throws java.lang.Exception
returns the number of currently selected rows for the variable

Throws:
java.lang.Exception

getNValidRows

public int getNValidRows()
                  throws java.lang.Exception
returns the number of currently selected rows for the variable which do not have missing values

Throws:
java.lang.Exception

setSelectRow

public void setSelectRow(int row,
                         boolean select)
                  throws java.lang.Exception
sets the select flag for a given row

Parameters:
row - marks the row in the vector
select - select flag for the row
Throws:
java.lang.Exception

getSelectRow

public boolean getSelectRow(int row)
returns whether a given row is currently selected. Returns false if not yet defined.

Parameters:
row - marks the row in the vector

selectValue

public void selectValue(java.lang.Object whichValue,
                        boolean fromPrevSelected)
                 throws java.lang.Exception
selects rows that match a given object from the currently selected set of rows

Parameters:
whichValue - the object to match
Throws:
java.lang.Exception

selectRows

public void selectRows(int start,
                       int end)
                throws java.lang.Exception
sets the select flag for all rows to true

Throws:
java.lang.Exception

setSelectRowsToMissing

public void setSelectRowsToMissing()
                            throws java.lang.Exception
sets all selected rows to missing

Throws:
java.lang.Exception

setSelectRows

public void setSelectRows(java.lang.Object aVal)
                   throws java.lang.Exception
sets all selected rows to a particular value

Parameters:
aVal - new value to use
Throws:
java.lang.Exception

restrictToValidRowsOnly

public void restrictToValidRowsOnly()
                             throws java.lang.Exception
sets the select flag for all valid (non-missing) rows to true

Throws:
java.lang.Exception

restrictToMatchingUseRows

public void restrictToMatchingUseRows(Variable aVar)
                               throws java.lang.Exception
restricts the select flag to those rows that are usable in both variables

Parameters:
aVar - the other variable
Throws:
java.lang.Exception

restrictToMatchingUseRows

public void restrictToMatchingUseRows(VariableOrganizer aVarOrg)
                               throws java.lang.Exception
restricts the use flag to those rows that are usable in the variables as well as in the Organizer

Parameters:
aVarOrg - the VariableOrganizer
Throws:
java.lang.Exception

selectUseRows

public void selectUseRows()
                   throws java.lang.Exception
restricts the select flag to those rows that are usable in both variables

Throws:
java.lang.Exception

selectAllRows

public void selectAllRows()
                   throws java.lang.Exception
sets the select flag for all rows to true

Throws:
java.lang.Exception

deselectAllRows

public void deselectAllRows()
                     throws java.lang.Exception
sets the select flag for all rows to false

Throws:
java.lang.Exception

copySelectStateFrom

public void copySelectStateFrom(Variable aVar)
                         throws java.lang.Exception
sets the select flag for all rows based on select state of another variable

Throws:
java.lang.Exception

replaceSelectedRows

public void replaceSelectedRows(java.lang.Object whichValue)
                         throws java.lang.Exception
sets the select flag for all rows based on select state of another variable

Parameters:
whichValue - the object to match
Throws:
java.lang.Exception

selectDuplicateRows

public void selectDuplicateRows()
                         throws java.lang.Exception
sets the select flag for all duplicate rows

Throws:
java.lang.Exception

combineSelectedWithSavedSelectedRows

public void combineSelectedWithSavedSelectedRows()
                                          throws java.lang.Exception
invert select rows

Throws:
java.lang.Exception

invertSelectedRows

public void invertSelectedRows()
                        throws java.lang.Exception
invert select rows

Throws:
java.lang.Exception

saveSelectedRows

public void saveSelectedRows()
                      throws java.lang.Exception
saves the select flag for all rows

Throws:
java.lang.Exception

restoreSelectedRows

public void restoreSelectedRows()
                         throws java.lang.Exception
restores the select flag for all rows from a previously saved set

Throws:
java.lang.Exception

findNextValue

public int findNextValue(int startSearchAt,
                         java.lang.Object aValue)
                  throws java.lang.Exception
returns the next selected row after a given row

Parameters:
startSearchAt - start searching at this row
aValue - search for such an object
Throws:
java.lang.Exception

findNextValidRow

public int findNextValidRow(int startSearchAt)
                     throws java.lang.Exception
returns the next selected row after a given row

Parameters:
startSearchAt - start searching at this row
Throws:
java.lang.Exception

findNextNonMissingRow

public int findNextNonMissingRow(int startSearchAt)
                          throws java.lang.Exception
returns the next selected row after a given row

Parameters:
startSearchAt - start searching at this row
Throws:
java.lang.Exception

findPreviousValidRow

public int findPreviousValidRow(int startSearchAt)
                         throws java.lang.Exception
returns the next lower selected row before a given row

Parameters:
startSearchAt - start searching at this row
Throws:
java.lang.Exception

findFirstValidRow

public int findFirstValidRow()
                      throws java.lang.Exception
returns the first selected row of the variable

Throws:
java.lang.Exception

findLastValidRow

public int findLastValidRow()
                     throws java.lang.Exception
returns the last selected row of the variable

Throws:
java.lang.Exception

deleteRow

public void deleteRow(int row)
               throws java.lang.Exception
delete a row from the Variable

Parameters:
row - the row to delete
Throws:
java.lang.Exception

deleteAllRows

public void deleteAllRows()
                   throws java.lang.Exception
delete all rows from the Variable

Throws:
java.lang.Exception

deleteMissingRows

public void deleteMissingRows()
                       throws java.lang.Exception
deletes all missing rows

Throws:
java.lang.Exception

deleteSelectedRows

public void deleteSelectedRows()
                        throws java.lang.Exception
deletes all selected rows

Throws:
java.lang.Exception

deleteNonSelectedRows

public void deleteNonSelectedRows()
                           throws java.lang.Exception
delete all non-selected rows

Throws:
java.lang.Exception

deleteDuplicateRows

public void deleteDuplicateRows()
                         throws java.lang.Exception
sets the select flag for all duplicate rows

Throws:
java.lang.Exception

sort

public Variable sort()
              throws java.lang.Exception
sorts the values for all rows using a map of hashcodes

Throws:
java.lang.Exception

sort

public Variable sort(boolean ascending)
              throws java.lang.Exception
sorts the values for all rows using a map of hashcodes

Parameters:
ascending - sort in ascending order?
Throws:
java.lang.Exception

sort2

public Variable sort2(boolean ascending)
               throws java.lang.Exception
sorts the values for all rows using a map of hashcodes

Parameters:
ascending - sort in ascending order?
Throws:
java.lang.Exception

reverseRows

public void reverseRows(int a1,
                        int a2,
                        boolean checkForOrganizer)
                 throws java.lang.Exception
reverses the values of two given rows

Parameters:
a1 - row one
a2 - row two
checkForOrganizer - should the function yield control to the VariableOrganizer
Throws:
java.lang.Exception

updateRowOrder

public void updateRowOrder()
                    throws java.lang.Exception
updates the row order for the variable

Throws:
java.lang.Exception

setRowOrderRow

public void setRowOrderRow(int row,
                           double rowNum)
                    throws java.lang.Exception
sets the number of rows for the Variable

Parameters:
row - marks the row in the vector
rowNum - the ordered number for the row
Throws:
java.lang.Exception

getRowOrderRow

public double getRowOrderRow(int row)
                      throws java.lang.Exception
returns whether a given row is currently selected. Returns false if not yet defined.

Parameters:
row - marks the row in the vector
Throws:
java.lang.Exception

getNMissingRows

public int getNMissingRows()
                    throws java.lang.Exception
returns the number of missing rows in the currently selected set

Throws:
java.lang.Exception

setMissingRow

public void setMissingRow(int row,
                          boolean missing)
                   throws java.lang.Exception
sets the missing flag for a given row

Parameters:
row - marks the row in the vector
missing - missing flag for the row
Throws:
java.lang.Exception

getMissingRow

public boolean getMissingRow(int row)
returns whether a given row is currently missing. Returns true if missing or not yet defined.

Parameters:
row - marks the row in the vector

getNUseRows

public int getNUseRows()
                throws java.lang.Exception
returns the number of usable rows in the currently selected set

Throws:
java.lang.Exception

getUseRow

public boolean getUseRow(int row)
returns whether a given row can be used. Returns true if not missing and selected.

Parameters:
row - marks the row in the vector

setHighlitedRow

public void setHighlitedRow(int row,
                            boolean highlite)
                     throws java.lang.Exception
sets the highlite flag for a given row

Parameters:
row - marks the row in the vector
highlite - highlite flag for the row
Throws:
java.lang.Exception

getHighlitedRow

public boolean getHighlitedRow(int row)
                        throws java.lang.Exception
returns whether a given row is currently highlited. Returns false if missing or not yet defined.

Parameters:
row - marks the row in the vector
Throws:
java.lang.Exception

highliteSelectedRows

public void highliteSelectedRows()
                          throws java.lang.Exception
highlites the selected rows only

Throws:
java.lang.Exception

highliteSelectedRows

public void highliteSelectedRows(boolean addToPreviousSet)
                          throws java.lang.Exception
highlites all selected rows

Parameters:
addToPreviousSet - combine with previously highlited set
Throws:
java.lang.Exception

setCustomColorRow

public void setCustomColorRow(int row,
                              java.awt.Color aColor)
                       throws java.lang.Exception
sets the custom color for a given row

Parameters:
row - marks the row in the vector
aColor - the color to use for the row
Throws:
java.lang.Exception

getCustomColorRow

public java.awt.Color getCustomColorRow(int row)
                                 throws java.lang.Exception
returns the custom color for a given row

Parameters:
row - marks the row in the vector
Throws:
java.lang.Exception

customColorSelectedRows

public void customColorSelectedRows(java.awt.Color aColor,
                                    boolean addToPreviousSet)
                             throws java.lang.Exception
sets a custom colors for all selected rows

Parameters:
aColor - the color to use for the rows
addToPreviousSet - combine with previously highlited set
Throws:
java.lang.Exception

makeNewDescriptives

public void makeNewDescriptives()
create a new set of descriptives for the variable the object


getDescriptives

public Descriptives getDescriptives()
                             throws java.lang.Exception
returns the descriptives for the variable

Throws:
java.lang.Exception

copyDescriptives

public Descriptives copyDescriptives()
                              throws java.lang.Exception
returns the descriptives for the variable

Throws:
java.lang.Exception

invalidDescriptives

public void invalidDescriptives()
descriptive stats need to be updated


fillDescriptives

public void fillDescriptives()
                      throws java.lang.Exception
fills the descriptive statistics for the variable, at the root level only a check for valid data points is performed

Throws:
java.lang.Exception

fillDescriptives

public void fillDescriptives(java.lang.Double hypVal)
                      throws java.lang.Exception
fills the descriptive statistics for the variable, at the root level only a check for valid data points is performed

Parameters:
hypVal - the value of the a-priori hypothesis mean
Throws:
java.lang.Exception

fillIDs

public void fillIDs()
             throws java.lang.Exception
fills a TreeMap with different values found in the variable using the currently selected set of rows

Throws:
java.lang.Exception

getNIDs

public int getNIDs()
returns the number of different values present in the currently selected set of rows


getIDString

public java.lang.String getIDString(int theIndex)
                             throws java.lang.Exception
returns a single entry for a key in the TreeMap as a String

Parameters:
theIndex - marks the position in the TreeMap
Throws:
java.lang.Exception

getIDStrings

public java.lang.String[] getIDStrings()
                                throws java.lang.Exception
returns the keys in the TreeMap as strings

Throws:
java.lang.Exception

getIDMap

public java.util.TreeMap getIDMap()
returns a TreeMap containing all different values found in the variable using the currently selected set of rows


getIDs

public java.lang.Object[] getIDs()
returns a TreeMap containing all different values found in the variable using the currently selected set of rows


getCombinedIDs

public java.util.TreeMap getCombinedIDs(Variable theOtherVariable)
returns a TreeMap containing all different values found in either this variable using the currently selected set of rows or in the selected rows of a second variable

Parameters:
theOtherVariable - the other variable to combine with this one

matchedIDs

public boolean matchedIDs(java.util.TreeMap theOtherIDs)
                   throws java.lang.Exception
returns whether there is a value in this variable that is not present in a given TreeMap

Parameters:
theOtherIDs - a second TreeMap
Throws:
java.lang.Exception

getFrequencies

public int[] getFrequencies()
                     throws java.lang.Exception
returns the frequencies for different instances of the variable using the currently selected set of rows up to the specified number of maxInstances

Throws:
java.lang.Exception

listSelectedRows

public void listSelectedRows()
lists data values for all selected rows in the variable


listUseRows

public void listUseRows()
                 throws java.lang.Exception
lists data values for all selected rows in the variable

Throws:
java.lang.Exception

listRows

public void listRows()
lists all data values in the variable


listRows

public void listRows(boolean selectedOnly)
lists all data values in the variable

Parameters:
selectedOnly - restrict to selected rows?

listRows

public void listRows(int startLine,
                     int endLine,
                     boolean selectedOnly)
lists data values for a range of rows

Parameters:
startLine - start listing from this row on
endLine - stop listing at this row
selectedOnly - restrict to selected rows?

listRowOrder

public void listRowOrder(int startLine,
                         int endLine,
                         boolean selectedOnly)
lists data values for a range of rows

Parameters:
startLine - start listing from this row on
endLine - stop listing at this row
selectedOnly - restrict to selected rows?

listSelectState

public void listSelectState()
lists for each row whether it is selected or not


listSelectState

public void listSelectState(int startLine,
                            int endLine)
lists for a range of rows whether it is selected or not

Parameters:
startLine - start listing from this row on
endLine - stop listing at this row

listDescriptives

public void listDescriptives()
                      throws java.lang.Exception
lists the descriptive statistics for the variable using the currently selected set of rows

Throws:
java.lang.Exception

listDescriptives

public void listDescriptives(java.lang.Double Mean)
                      throws java.lang.Exception
lists the descriptive statistics for the variable using the currently selected set of rows

Throws:
java.lang.Exception

listGroupDescriptives

public void listGroupDescriptives(Variable theXVariable)
                           throws java.lang.Exception
lists the descriptives for the groups identified by X

Parameters:
theXVariable - provides the information on how to form the groups
Throws:
java.lang.Exception

listGroupDescriptivesNoDia

public void listGroupDescriptivesNoDia(Variable theXVariable)
                                throws java.lang.Exception
lists the descriptives for the groups identified by X

Parameters:
theXVariable - provides the information on how to form the groups
Throws:
java.lang.Exception

checkMatchingRows

public boolean checkMatchingRows(ContingencyTable aMat)
                          throws java.lang.Exception
examine whether this variables has the same number of rows as the provided ContingencyTable

Parameters:
aMat - the ContingencyTable to compare with
Throws:
java.lang.Exception

checkMinUseRows

public boolean checkMinUseRows(int minRows)
                        throws java.lang.Exception
examines whether a minimum number rows is selected

Parameters:
minRows - the minimum number of rows
Throws:
java.lang.Exception

checkSameSelectRows

public boolean checkSameSelectRows(Variable theVar)
                            throws java.lang.Exception
examines whether the same rows are selected as in another variable

Parameters:
theVar - the other variable to compare with
Throws:
java.lang.Exception

checkSameSelectRows

public boolean checkSameSelectRows(VariableOrganizer theVarOrganizer)
                            throws java.lang.Exception
examines whether the same rows are selected as in another variable

Parameters:
theVarOrganizer - the VariableOrganizer to compare with
Throws:
java.lang.Exception

checkSameUseRows

public boolean checkSameUseRows(Variable theVar)
                         throws java.lang.Exception
examines whether the same rows are selected and not missing as in another variable

Parameters:
theVar - the Variable to compare with
Throws:
java.lang.Exception

checkSameUseRows

public boolean checkSameUseRows(VariableOrganizer theVarOrganizer)
                         throws java.lang.Exception
examines whether the same rows are selected and not missing as in another variable

Parameters:
theVarOrganizer - the VariableOrganizer to compare with
Throws:
java.lang.Exception

checkNumberIDs

public void checkNumberIDs(int compareTo)
                    throws java.lang.Exception
checks whether there is a given number of distinct IDs present in the currently selected set of rows

Parameters:
compareTo - number of distinct IDs to compare to
Throws:
java.lang.Exception

checkSameIDs

public void checkSameIDs(Variable theOtherVariable)
                  throws java.lang.Exception
checks whether two variables have identical sets of distinct IDs in the currently selected set of rows

Parameters:
theOtherVariable - the other variable to compare with
Throws:
java.lang.Exception

checkValidRowRange

public boolean checkValidRowRange(int row)
                           throws java.lang.Exception
checks whether a given row is within a valid range

Parameters:
row - marks the row in the vector
Throws:
java.lang.Exception

getCrossTabulation

public ContingencyTable getCrossTabulation(Variable theXVariable,
                                           boolean sameIDs,
                                           boolean includeDiagonal)
returns a crosstabulation of values for two variables in form of a matrix

Parameters:
theXVariable - the variable contains information on how to form the groups
sameIDs - do the same variable states exist in both x and y variable
includeDiagonal - should it include the diagonal?

getCrossTabulation

public ContingencyTable getCrossTabulation(Variable theXVariable,
                                           java.util.TreeMap xHash,
                                           java.util.TreeMap yHash,
                                           boolean includeDiagonal)
returns a crosstabulation of values for two variables in form of a matrix

Parameters:
theXVariable - the variable contains information on how to form the groups
xHash - use these states for the x variable
yHash - use these states for the y variable
includeDiagonal - should it include the diagonal?

getInteractions

public InteractionTable getInteractions(Variable theXVariable)
                                 throws java.lang.Exception
returns a crosstabulation of values for two variables in form of an interaction matrix

Parameters:
theXVariable - a second variable
Throws:
java.lang.Exception

getTransitions

public ContingencyTable getTransitions()
returns the transitions among consecutive values in form of a matrix


getSquEuclidian

public double getSquEuclidian(Variable aVar)
                       throws java.lang.Exception
returns the Euclidian proximity measure to another variable

Parameters:
aVar - a second variable
Throws:
java.lang.Exception

getManhattan

public double getManhattan(Variable aVar)
                    throws java.lang.Exception
returns the Manhattan proximity measure to another variable

Parameters:
aVar - a second variable
Throws:
java.lang.Exception

getJaccard

public double getJaccard(Variable aVar)
                  throws java.lang.Exception
returns the Manhattan proximity measure to another variable

Parameters:
aVar - a second variable
Throws:
java.lang.Exception

getProximity

public double getProximity(Variable aVar)
                    throws java.lang.Exception
returns the proximity measure to another variable

Parameters:
aVar - a second variable
Throws:
java.lang.Exception

getProximity

public double getProximity(Variable aVar,
                           int How)
                    throws java.lang.Exception
returns the proximity measure to another variable

Parameters:
aVar - a second variable
Throws:
java.lang.Exception

asJAMAMatrix

public Matrix asJAMAMatrix()
                    throws java.lang.Exception
returns a matrix for the variables in the variableorganizer which have been selected as dependent variables (i.e., VariableDesignRole.Y) and which are ordinal or nominal

Throws:
java.lang.Exception

asVariableOrganizer

public VariableOrganizer asVariableOrganizer()
                                      throws java.lang.Exception
returns the variable as a variable organizer filled with this variable

Throws:
java.lang.Exception

makeTableSubSet

public ContingencyTable makeTableSubSet(ContingencyTable aTable)
                                 throws java.lang.Exception
returns a subset of row data values for the ContingencyTable as a ContingencyTable.

Parameters:
aTable - the independent ContingencyTable
Throws:
java.lang.Exception