public class VariableOrganizer
extends java.util.Vector<java.lang.Object>
implements java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
java.util.Vector<java.lang.Boolean> |
gRowHighlitedState |
java.util.Vector<java.lang.Boolean> |
gRowSaveSelectedState |
java.util.Vector<java.lang.Boolean> |
gRowSelectedState |
| Constructor and Description |
|---|
VariableOrganizer()
Standard constructor for a VariableOrganizer
|
VariableOrganizer(DataFileParser aParser)
Standard constructor for a VariableOrganizer using a DataParser object.
|
VariableOrganizer(DataFileParser aParser,
boolean autoExtract,
boolean withTitles)
Standard constructor for a VariableOrganizer using a DataParser object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSelectRows(Variable partitionVar,
java.lang.Object whichValue)
adds rows that match a given object to the currently selected set of rows
|
StrVariable |
asConcatStrVariable()
returns a new VariableOrganizer containing all variables which have been
selected as independent variables (i.e., VariableDesignRole.X) and all selected rows
|
DataTable |
asDataTable()
returns a DataTable of doubles for variables in the variableorganizer which have been
selected as dependent variables (i.e., VariableDesignRole.Y)
|
double[][] |
asDoubleArray()
returns a 2D array of doubles for the variables in the variableorganizer which have been
selected as dependent variables (i.e., VariableDesignRole.Y) and which are ordinal or
nominal
|
com.lobsterman.JavaGrinders.Jama.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
|
DataTable |
asProximity()
returns a proximity matrix for the variables in the variableorganizer which have been selected
as dependent variables (i.e., VariableDesignRole.Y)
|
java.lang.String[][] |
asStringArray()
returns a 2D array of doubles for the variables in the variableorganizer which have been
selected as dependent variables (i.e., VariableDesignRole.Y)
|
void |
asTablePresenter()
Creates a presenter from a VariableOrganizer for all the variables the organizer knows about
|
VariableOrganizer |
asVariableOrganizerX()
returns a new VariableOrganizer containing all variables which have been
selected as independent variables (i.e., VariableDesignRole.X) and all selected rows
|
VariableOrganizer |
asVariableOrganizerY()
returns a new VariableOrganizer containing all variables which have been
selected as dependent variables (i.e., VariableDesignRole.Y) and all selected rows
|
boolean |
checkMinVars(int minVars)
examines whether a minimum number of variables is selected
|
boolean |
checkValidRowRange(int row)
checks whether a given row is within a valid range
|
void |
clearAllDesignRoles()
clears all assigned design roles for the variables
|
void |
clearVariableDesignRoles()
clears the design roles from all columns
|
boolean |
confirmMinXVariables(int nXs)
checks whether there are sufficient dependent variables available
|
boolean |
confirmMinYVariables(int nYs)
checks whether there are sufficient dependent variables available
|
void |
copySelectStateFrom(Variable aVar)
sets the select flag for all rows based on select state of another variable
|
void |
deleteAllRows()
deletes all rows from all the variables that are registered with the VariableOrganizer
|
void |
deleteCol(int i)
delete a column from the VariableOrganizer
|
void |
deleteCols()
delete all columns from the Organizer
|
void |
deleteColsNonX()
delete all non-X-selected columns from the Organizer
|
void |
deleteColsNonY()
delete all non-Y-selected columns from the Organizer
|
void |
deleteNonSelectedRows()
delete all non-selected rows from the Organizer
|
void |
deleteRow(int row)
deletes a row from all the variables that are registered with the VariableOrganizer
|
void |
deleteSelectedRows()
deletes all selected rows
|
void |
deselectAllRows()
sets the select flag for all rows to false
|
void |
deselectRowsWithMissing()
deselects all rows if a value is missing in any of the included variables
|
int |
findFirstSelectedRow()
returns the first selected row of the variable
|
int |
findLastSelectedRow()
returns the last selected row of the variable
|
int |
findNextSelectedRow(int startSearchAt)
returns the next selected row after a given row
|
int |
findPreviousSelectedRow(int startSearchAt)
returns the next lower selected row before a given row
|
java.lang.String |
getDataFileName() |
Variable |
getFirstLabelColumn()
returns the first label variable in the VariableOrganizer
|
Variable |
getFirstXColumn()
returns the first dependent (X) variable in the VariableOrganizer
|
Variable |
getFirstYColumn()
returns the first dependent (Y) variable in the VariableOrganizer
|
boolean |
getHighlitedRow(int row)
returns whether a given row is currently highlited
|
double[] |
getItemValues(int row)
lists the Variables registered with the VariableOrganizer
|
java.lang.String[] |
getLabels()
return the currently selected set of labels
|
int |
getNextSelectLabelIndex(int startSearchAt)
returns the next label column after a given column
|
int |
getNextSelectXColumnIndex(int startSearchAt)
returns the next selected column after a given column
|
int |
getNextSelectYColumnIndex(int startSearchAt)
returns the next selected column after a given column
|
int |
getNLabels()
how many labels are under the control of this VariableOrganizer
|
int |
getNRows()
returns the number of rows for the VariableOrganizer
|
int |
getNSelectRows()
returns the number of selected rows
|
int |
getNValidRows()
returns the number of valid rows in the currently selected set
|
int |
getNVariables()
how many variables are under the control of this VariableOrganizer
|
int |
getNXVariables()
how many X variables are under the control of this VariableOrganizer
|
int |
getNYVariables()
how many Y variables are under the control of this VariableOrganizer
|
DataFileParser |
getParser() |
boolean |
getSelectCell(int col,
int row)
returns whether a given cell of the datamatrix is currently selected
|
boolean |
getSelectRow(int row)
returns whether a given row is currently selected
|
Variable |
getVariable(int number)
returns a particular variable designated by a reference number,
this corresponds to the zero-based order in which variables were
registered with the VariableOrganizer.
|
Variable |
getVariable(java.lang.String variableName)
returns a particular variable designated by a variable name
|
int |
getVariableDesignRole(int col)
returns whether a given column is currently chosen as X, Y, label or not selected
|
int |
getVariableIndex(java.lang.String variableName)
returns the index of a particular variable designated by a variable name
|
double[] |
getVariableMeans()
lists the Variables registered with the VariableOrganizer
|
java.lang.String[] |
getVariableNames()
return the names of all variables
|
int |
getVariablePosition(Variable aVar)
returns the position in the vector for a particular variable
this corresponds to the zero-based order in which variables were
registered with the VariableOrganizer.
|
boolean |
hasLabel()
how many labels are under the control of this VariableOrganizer
|
void |
invertSelectedRows()
invert select rows
|
DataTable |
itemsAsDistanceMatrix(int proximitiesType)
returns a proximity matrix for the variables in the variableorganizer which have been selected
as dependent variables (i.e., VariableDesignRole.Y)
|
void |
listDescriptives()
list descriptives for all Yvariables of the variableorganizer
|
void |
listRow(int row)
lists data values for a single row
|
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 |
listVariables()
lists the Variables registered with the VariableOrganizer
|
void |
moveCol(Variable aVar,
int destCol)
moves a column
|
void |
register(Variable theVariable)
submit control of the variable to a VariableOrganizer
|
void |
restoreSelectedRows()
restores the select flag for all rows from a previously saved set
|
void |
restrictToMatchingUseRows()
restricts to those rows that are usable across the entire VariableOrganizer
|
void |
reverseRows(int a1,
int a2)
reverses the values of two given rows
|
void |
saveSelectedRows()
saves the select flag for all rows
|
void |
selectAbove(Variable partitionVar,
double cutoffValue,
boolean fromPrevSelected)
selects all rows that contain a double value above a given double value with the option
to select from the previous set
|
void |
selectAllRows()
sets the select flag for all rows to true
|
void |
selectBelow(Variable partitionVar,
double cutoffValue,
boolean fromPrevSelected)
selects all rows that contain a double value below a given double value with the option
to select from the previous set
|
void |
selectEveryNthRow(int n)
sets the select flag for every nth row to true
|
void |
selectRange(Variable partitionVar,
double lowValue,
double highValue,
boolean fromPrevSelected)
selects all rows that contain a double value between two given double values with
the option from the previous set
|
void |
selectRows(int start,
int end)
sets the select flag for all rows to true
|
void |
selectValue(Variable partitionVar,
java.lang.Object whichValue,
boolean fromPrevSelected)
selects all rows that match a given value in a given variable with the option to select
from the previous set
|
void |
setAutoColumnColors()
stacks a number of dependent variables on top of each other, their respective variable names are stored in a second variable
|
void |
setDataFileName(java.lang.String fileName) |
void |
setHighlitedRow(int row,
boolean hil)
sets the highlited info for a row
|
void |
setNRows(int rows)
sets the number of rows for the VariableOrganizer
|
void |
setSelectRow(int row,
boolean sel)
sets the selection info for a row
|
void |
setVariable(Variable aVar,
int index)
returns a particular variable designated by a reference number,
this corresponds to the zero-based order in which variables were
registered with the VariableOrganizer.
|
void |
setVariableDesignRole(int col,
int designRole)
sets a design role for a column
|
void |
setVariableDesignRoleForAll(int designRole)
sets a design role for every column (i.e., X, Y, label or not selected)
|
VariableOrganizer |
sort(int varIndex)
sorts the VariableOrganizer by the values in a variable
|
VariableOrganizer |
stackYs()
stacks a number of dependent variables on top of each other, their respective variable names are stored in a second variable
|
void |
subSelectRows(Variable partitionVar,
java.lang.Object whichValue)
deselects rows that match a given object from the currently selected set of rows
|
void |
swapRows(int index1,
int index2)
swaps the values in the two rows of all variables
|
void |
toFile()
writes a VariableOrganizer into a file writer
|
void |
toFile(java.io.BufferedWriter bw)
writes a VariableOrganizer into a file writer
|
void |
updateDesignRoleSums()
updates the design roles for variables
|
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, toString, trimToSizepublic java.util.Vector<java.lang.Boolean> gRowSelectedState
public java.util.Vector<java.lang.Boolean> gRowHighlitedState
public java.util.Vector<java.lang.Boolean> gRowSaveSelectedState
public VariableOrganizer()
public VariableOrganizer(DataFileParser aParser, boolean autoExtract, boolean withTitles)
aParser - an instance of DataFileParser
class coordinates reading data points from a text fileautoExtract - should variables be extracted automatically?withTitles - if manually extracted, are titles present?public VariableOrganizer(DataFileParser aParser)
aParser - an instance of DataFileParser
class coordinates reading data points from a text filepublic void setNRows(int rows)
throws java.lang.Exception
rows - number of rows to setjava.lang.Exceptionpublic int getNRows()
public void register(Variable theVariable) throws java.lang.Exception
theVariable - a Variable containing datajava.lang.Exceptionpublic int getVariablePosition(Variable aVar) throws java.lang.Exception
aVar - the variable to search forjava.lang.Exceptionpublic void setVariable(Variable aVar, int index) throws java.lang.Exception
aVar - the variable to storeindex - storage number for the variablejava.lang.Exceptionpublic Variable getVariable(int number)
number - storage number for the variablepublic Variable getFirstXColumn()
public Variable getFirstYColumn()
public Variable getFirstLabelColumn() throws java.lang.Exception
java.lang.Exceptionpublic int getNextSelectXColumnIndex(int startSearchAt)
startSearchAt - start searching at this column indexpublic int getNextSelectYColumnIndex(int startSearchAt)
startSearchAt - start searching at this column indexpublic int getNextSelectLabelIndex(int startSearchAt)
startSearchAt - start searching at this column indexpublic Variable getVariable(java.lang.String variableName) throws java.lang.Exception
variableName - find a variable with this namejava.lang.Exceptionpublic int getVariableIndex(java.lang.String variableName)
throws java.lang.Exception
variableName - find a variable with this namejava.lang.Exceptionpublic int getNVariables()
public int getNXVariables()
public int getNYVariables()
public int getNLabels()
public boolean hasLabel()
public java.lang.String[] getLabels()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String[] getVariableNames()
throws java.lang.Exception
java.lang.Exceptionpublic void updateDesignRoleSums()
public double[] getItemValues(int row)
throws java.lang.Exception
java.lang.Exceptionpublic void deleteCol(int i)
i - the column to deletepublic void deleteColsNonY()
throws java.lang.Exception
java.lang.Exceptionpublic void deleteColsNonX()
throws java.lang.Exception
java.lang.Exceptionpublic void deleteCols()
throws java.lang.Exception
java.lang.Exceptionpublic VariableOrganizer stackYs() throws java.lang.Exception
java.lang.Exceptionpublic void setAutoColumnColors()
throws java.lang.Exception
java.lang.Exceptionpublic void selectAllRows()
throws java.lang.Exception
java.lang.Exceptionpublic void selectRows(int start,
int end)
throws java.lang.Exception
java.lang.Exceptionpublic void selectEveryNthRow(int n)
throws java.lang.Exception
n - select every nth rowjava.lang.Exceptionpublic void deselectAllRows()
throws java.lang.Exception
java.lang.Exceptionpublic int getNSelectRows()
throws java.lang.Exception
java.lang.Exceptionpublic int findNextSelectedRow(int startSearchAt)
throws java.lang.Exception
startSearchAt - start searching at this rowjava.lang.Exceptionpublic int findPreviousSelectedRow(int startSearchAt)
throws java.lang.Exception
startSearchAt - start searching at this rowjava.lang.Exceptionpublic int findFirstSelectedRow()
throws java.lang.Exception
java.lang.Exceptionpublic int findLastSelectedRow()
throws java.lang.Exception
java.lang.Exceptionpublic void setSelectRow(int row,
boolean sel)
throws java.lang.Exception
row - the row to setsel - selection status for the rowjava.lang.Exceptionpublic boolean getSelectRow(int row)
throws java.lang.Exception
row - marks the row in the vectorjava.lang.Exceptionpublic void saveSelectedRows()
throws java.lang.Exception
java.lang.Exceptionpublic void restoreSelectedRows()
throws java.lang.Exception
java.lang.Exceptionpublic int getNValidRows()
throws java.lang.Exception
java.lang.Exceptionpublic void deselectRowsWithMissing()
public void deleteRow(int row)
throws java.lang.Exception
row - the row to deletejava.lang.Exceptionpublic void invertSelectedRows()
throws java.lang.Exception
java.lang.Exceptionpublic void deleteSelectedRows()
throws java.lang.Exception
java.lang.Exceptionpublic void deleteNonSelectedRows()
throws java.lang.Exception
java.lang.Exceptionpublic void deleteAllRows()
throws java.lang.Exception
java.lang.Exceptionpublic void clearVariableDesignRoles()
throws java.lang.Exception
java.lang.Exceptionpublic void setVariableDesignRoleForAll(int designRole)
throws java.lang.Exception
designRole - the design role to setjava.lang.Exceptionpublic void setVariableDesignRole(int col,
int designRole)
throws java.lang.Exception
col - the column identified by numberdesignRole - the design role to setjava.lang.Exceptionpublic int getVariableDesignRole(int col)
col - marks the column in the vectorpublic void clearAllDesignRoles()
throws java.lang.Exception
java.lang.Exceptionpublic void moveCol(Variable aVar, int destCol) throws java.lang.Exception
aVar - marks the column to movedestCol - marks where the column should be moved tojava.lang.Exceptionpublic boolean getSelectCell(int col,
int row)
throws java.lang.Exception
col - marks the column in the matrixrow - marks the row in the matrixjava.lang.Exceptionpublic void setHighlitedRow(int row,
boolean hil)
throws java.lang.Exception
row - the row to sethil - highlited status for the rowjava.lang.Exceptionpublic boolean getHighlitedRow(int row)
throws java.lang.Exception
row - marks the row in the vectorjava.lang.Exceptionpublic void selectValue(Variable partitionVar, java.lang.Object whichValue, boolean fromPrevSelected) throws java.lang.Exception
partitionVar - the variable to searchwhichValue - the object to matchfromPrevSelected - boolean that controls whether the seach applies to the
previously selected set onlyjava.lang.Exceptionpublic void selectAbove(Variable partitionVar, double cutoffValue, boolean fromPrevSelected) throws java.lang.Exception
partitionVar - the variable to searchcutoffValue - the double to compare withfromPrevSelected - boolean that controls whether the seach applies to the
previously selected set onlyjava.lang.Exceptionpublic void selectBelow(Variable partitionVar, double cutoffValue, boolean fromPrevSelected) throws java.lang.Exception
partitionVar - the variable to searchcutoffValue - the double to compare withfromPrevSelected - boolean that controls whether the seach applies to the
previously selected set onlyjava.lang.Exceptionpublic void selectRange(Variable partitionVar, double lowValue, double highValue, boolean fromPrevSelected) throws java.lang.Exception
partitionVar - the variable to searchlowValue - the double to compare withhighValue - the double to compare withfromPrevSelected - boolean that controls whether the seach applies to the
previously selected set onlyjava.lang.Exceptionpublic void addSelectRows(Variable partitionVar, java.lang.Object whichValue) throws java.lang.Exception
partitionVar - the variable to searchwhichValue - the object to matchjava.lang.Exceptionpublic void subSelectRows(Variable partitionVar, java.lang.Object whichValue) throws java.lang.Exception
partitionVar - the variable to searchwhichValue - the object to matchjava.lang.Exceptionpublic void copySelectStateFrom(Variable aVar) throws java.lang.Exception
java.lang.Exceptionpublic void restrictToMatchingUseRows()
throws java.lang.Exception
java.lang.Exceptionpublic void swapRows(int index1,
int index2)
throws java.lang.Exception
index1 - the first row indexindex2 - the second row indexjava.lang.Exceptionpublic VariableOrganizer sort(int varIndex) throws java.lang.Exception
varIndex - the Variable to use for sortingjava.lang.Exceptionpublic double[] getVariableMeans()
throws java.lang.Exception
java.lang.Exceptionpublic void listVariables()
public void listSelectedRows()
public void listSelectState()
public void listSelectState(int startLine,
int endLine)
startLine - start listing from this row onendLine - stop listing at this rowpublic void listRow(int row)
throws java.lang.Exception
row - start listing from this row onjava.lang.Exceptionpublic void listRows()
public void listRows(boolean selectedOnly)
selectedOnly - restrict to selected rows?public void listRows(int startLine,
int endLine,
boolean selectedOnly)
startLine - start listing from this row onendLine - stop listing at this rowselectedOnly - restrict to selected rows?public void listDescriptives()
throws java.lang.Exception
java.lang.Exceptionpublic void reverseRows(int a1,
int a2)
throws java.lang.Exception
a1 - row onea2 - row twojava.lang.Exceptionpublic VariableOrganizer asVariableOrganizerY() throws java.lang.Exception
java.lang.Exceptionpublic VariableOrganizer asVariableOrganizerX() throws java.lang.Exception
java.lang.Exceptionpublic StrVariable asConcatStrVariable() throws java.lang.Exception
java.lang.Exceptionpublic DataTable asDataTable() throws java.lang.Exception
java.lang.Exceptionpublic double[][] asDoubleArray()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String[][] asStringArray()
throws java.lang.Exception
java.lang.Exceptionpublic com.lobsterman.JavaGrinders.Jama.Matrix asJAMAMatrix()
throws java.lang.Exception
java.lang.Exceptionpublic DataTable asProximity() throws java.lang.Exception
java.lang.Exceptionpublic void asTablePresenter()
throws java.lang.Exception
java.lang.Exceptionpublic void toFile()
throws java.lang.Exception
java.lang.Exceptionpublic void toFile(java.io.BufferedWriter bw)
throws java.lang.Exception
bw - the BufferedWriter to write tojava.lang.Exceptionpublic boolean checkValidRowRange(int row)
throws java.lang.Exception
row - marks the row in the vectorjava.lang.Exceptionpublic boolean checkMinVars(int minVars)
throws java.lang.Exception
minVars - the minimum number of variablesjava.lang.Exceptionpublic boolean confirmMinXVariables(int nXs)
throws java.lang.Exception
nXs - required X variablesjava.lang.Exceptionpublic boolean confirmMinYVariables(int nYs)
throws java.lang.Exception
nYs - required Y variablesjava.lang.Exceptionpublic DataTable itemsAsDistanceMatrix(int proximitiesType) throws java.lang.Exception
java.lang.Exceptionpublic DataFileParser getParser()
public java.lang.String getDataFileName()
public void setDataFileName(java.lang.String fileName)
Copyright 2016