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
|
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()
gets the data file name
|
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()
gets the parser
|
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
|
int |
getVariableIndex(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.
|
double[] |
getVariableMeans()
lists the Variables registered with the VariableOrganizer
|
java.lang.String[] |
getVariableNames()
return the names of all variables
|
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 Y variables 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)
sets the data file name
|
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, trimToSize
public 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.Exception
- ...public int getNRows()
public void register(Variable theVariable) throws java.lang.Exception
theVariable
- a Variable containing datajava.lang.Exception
- ...public int getVariableIndex(Variable aVar) throws java.lang.Exception
aVar
- the variable index for a variablejava.lang.Exception
- ...public void setVariable(Variable aVar, int index) throws java.lang.Exception
aVar
- the variable to storeindex
- storage number for the variablejava.lang.Exception
- ...public Variable getVariable(int number)
number
- storage number for the variablepublic Variable getFirstXColumn()
public Variable getFirstYColumn()
public Variable getFirstLabelColumn() throws java.lang.Exception
java.lang.Exception
- ...public 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.Exception
- ...public int getVariableIndex(java.lang.String variableName) throws java.lang.Exception
variableName
- find a variable with this namejava.lang.Exception
- ...public 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.Exception
- ...public java.lang.String[] getVariableNames() throws java.lang.Exception
java.lang.Exception
- ...public void updateDesignRoleSums()
public double[] getItemValues(int row) throws java.lang.Exception
row
- the rowjava.lang.Exception
- ...public void deleteCol(int i)
i
- the column to deletepublic void deleteColsNonY() throws java.lang.Exception
java.lang.Exception
- ...public void deleteColsNonX() throws java.lang.Exception
java.lang.Exception
- ...public void deleteCols() throws java.lang.Exception
java.lang.Exception
- ...public VariableOrganizer stackYs() throws java.lang.Exception
java.lang.Exception
- ...public void setAutoColumnColors() throws java.lang.Exception
java.lang.Exception
- ...public void selectAllRows() throws java.lang.Exception
java.lang.Exception
- ...public void selectRows(int start, int end) throws java.lang.Exception
start
- start rowend
- end rowjava.lang.Exception
- ...public void selectEveryNthRow(int n) throws java.lang.Exception
n
- select every nth rowjava.lang.Exception
- ...public void deselectAllRows() throws java.lang.Exception
java.lang.Exception
- ...public int getNSelectRows() throws java.lang.Exception
java.lang.Exception
- ...public int findNextSelectedRow(int startSearchAt) throws java.lang.Exception
startSearchAt
- start searching at this rowjava.lang.Exception
- ...public int findPreviousSelectedRow(int startSearchAt) throws java.lang.Exception
startSearchAt
- start searching at this rowjava.lang.Exception
- ...public int findFirstSelectedRow() throws java.lang.Exception
java.lang.Exception
- ...public int findLastSelectedRow() throws java.lang.Exception
java.lang.Exception
- ...public void setSelectRow(int row, boolean sel) throws java.lang.Exception
row
- the row to setsel
- selection status for the rowjava.lang.Exception
- ...public boolean getSelectRow(int row) throws java.lang.Exception
row
- marks the row in the vectorjava.lang.Exception
- ...public void saveSelectedRows() throws java.lang.Exception
java.lang.Exception
- ...public void restoreSelectedRows() throws java.lang.Exception
java.lang.Exception
- ...public int getNValidRows() throws java.lang.Exception
java.lang.Exception
- ...public void deselectRowsWithMissing()
public void deleteRow(int row) throws java.lang.Exception
row
- the row to deletejava.lang.Exception
- ...public void invertSelectedRows() throws java.lang.Exception
java.lang.Exception
- ...public void deleteSelectedRows() throws java.lang.Exception
java.lang.Exception
- ...public void deleteNonSelectedRows() throws java.lang.Exception
java.lang.Exception
- ...public void deleteAllRows() throws java.lang.Exception
java.lang.Exception
- ...public void clearVariableDesignRoles() throws java.lang.Exception
java.lang.Exception
- ...public void setVariableDesignRoleForAll(int designRole) throws java.lang.Exception
designRole
- the design role to setjava.lang.Exception
- ...public void setVariableDesignRole(int col, int designRole) throws java.lang.Exception
col
- the column identified by numberdesignRole
- the design role to setjava.lang.Exception
- ...public int getVariableDesignRole(int col)
col
- marks the column in the vectorpublic void clearAllDesignRoles() throws java.lang.Exception
java.lang.Exception
- ...public 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.Exception
- ...public boolean getSelectCell(int col, int row) throws java.lang.Exception
col
- marks the column in the matrixrow
- marks the row in the matrixjava.lang.Exception
- ...public void setHighlitedRow(int row, boolean hil) throws java.lang.Exception
row
- the row to sethil
- highlited status for the rowjava.lang.Exception
- ...public boolean getHighlitedRow(int row) throws java.lang.Exception
row
- marks the row in the vectorjava.lang.Exception
- ...public 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.Exception
- ...public 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.Exception
- ...public 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.Exception
- ...public 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.Exception
- ...public void addSelectRows(Variable partitionVar, java.lang.Object whichValue) throws java.lang.Exception
partitionVar
- the variable to searchwhichValue
- the object to matchjava.lang.Exception
- ...public void subSelectRows(Variable partitionVar, java.lang.Object whichValue) throws java.lang.Exception
partitionVar
- the variable to searchwhichValue
- the object to matchjava.lang.Exception
- ...public void copySelectStateFrom(Variable aVar) throws java.lang.Exception
aVar
- the variable to copy fromjava.lang.Exception
- ...public void restrictToMatchingUseRows() throws java.lang.Exception
java.lang.Exception
- ...public void swapRows(int index1, int index2) throws java.lang.Exception
index1
- the first row indexindex2
- the second row indexjava.lang.Exception
- ...public VariableOrganizer sort(int varIndex) throws java.lang.Exception
varIndex
- the Variable to use for sortingjava.lang.Exception
- ...public double[] getVariableMeans() throws java.lang.Exception
java.lang.Exception
- ...public 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.Exception
- ...public 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.Exception
- ...public void reverseRows(int a1, int a2) throws java.lang.Exception
a1
- row onea2
- row twojava.lang.Exception
- ...public VariableOrganizer asVariableOrganizerY() throws java.lang.Exception
java.lang.Exception
- ...public VariableOrganizer asVariableOrganizerX() throws java.lang.Exception
java.lang.Exception
- ...public StrVariable asConcatStrVariable() throws java.lang.Exception
java.lang.Exception
- ...public DataTable asDataTable() throws java.lang.Exception
java.lang.Exception
- ...public double[][] asDoubleArray() throws java.lang.Exception
java.lang.Exception
- ...public java.lang.String[][] asStringArray() throws java.lang.Exception
java.lang.Exception
- ...public Matrix asJAMAMatrix() throws java.lang.Exception
java.lang.Exception
- ...public DataTable asProximity() throws java.lang.Exception
java.lang.Exception
- ...public void asTablePresenter() throws java.lang.Exception
java.lang.Exception
- ...public void toFile() throws java.lang.Exception
java.lang.Exception
- ...public void toFile(java.io.BufferedWriter bw) throws java.lang.Exception
bw
- the BufferedWriter to write tojava.lang.Exception
- ...public boolean checkValidRowRange(int row) throws java.lang.Exception
row
- marks the row in the vectorjava.lang.Exception
- ...public boolean checkMinVars(int minVars) throws java.lang.Exception
minVars
- the minimum number of variablesjava.lang.Exception
- ...public boolean confirmMinXVariables(int nXs) throws java.lang.Exception
nXs
- required X variablesjava.lang.Exception
- ...public boolean confirmMinYVariables(int nYs) throws java.lang.Exception
nYs
- required Y variablesjava.lang.Exception
- ...public DataTable itemsAsDistanceMatrix(int proximitiesType) throws java.lang.Exception
proximitiesType
- the type of proximity measurejava.lang.Exception
- ...public DataFileParser getParser()
public java.lang.String getDataFileName()
public void setDataFileName(java.lang.String fileName)
fileName
- the file nameRH, 2017