cmu.survey.editor.manipulators
Class VariableNameChecker

java.lang.Object
  extended by cmu.survey.editor.manipulators.VariableNameChecker

public class VariableNameChecker
extends java.lang.Object


Nested Class Summary
static class VariableNameChecker.ModifiedVariableInfo
           
static class VariableNameChecker.PageIterator
           
static class VariableNameChecker.QuestionIterator
           
static class VariableNameChecker.VariableInfo
           
static class VariableNameChecker.VariableIterator
           
 
Constructor Summary
VariableNameChecker()
           
 
Method Summary
 PropertiesPanel.ErrorDetail checkVariableForNonDuplicateErrors()
           
static PropertiesPanel.ErrorDetail checkVariableForNonDuplicateErrors(VariableNameChecker.VariableInfo variableInfo)
           
 PropertiesPanel.ErrorDetail checkVariableNameForDuplicates()
           
 PropertiesPanel.ErrorDetail checkVariableNameForDuplicates(StringDataBit variableName)
           
protected static PropertiesPanel.ErrorDetail checkVariableNameForDuplicates(StringDataBit variableName, Page page, int qNum, VariableDataBitSet variable, StringDataBit variableType, QuestionDataBitSet question2, DataTableModel answersTable)
           
static PropertiesPanel.ErrorDetail checkVariableNameForDuplicates(java.lang.String variableName, DataTableModel answersTableModel, DataBitStorage objectStorage)
           
protected static PropertiesPanel.ErrorDetail checkVariableNameForDuplicates(java.lang.String variableName, Page page, int qNum, VariableDataBitSet variable, StringDataBit variableType, QuestionDataBitSet question2, DataTableModel answersTableModel)
          Assumes you've already checked that the table names are the same (you should check them at the top of each page)
 PropertiesPanel.ErrorDetail checkVariableNameForErrors()
           
 boolean fixVariable(VariableDataBitSet variable, StringDataBit tableName)
           
static java.util.Vector<VariableNameChecker.ModifiedVariableInfo> getAllVariablesAsModifiedInfoFrom(DataBitStorage objectStorage, StringDataBit answersTableName, QuestionDataBitSet question)
           
static java.util.Vector<VariableDataBitSet> getAllVariablesFrom(QuestionDataBitSet question)
           
 DataTableModel getAnswersTable()
           
 java.lang.String getSuggestedName()
           
static java.lang.String getSuggestedName(DataTableModel answersTableModel)
           
static java.lang.String getSuggestedName(DataTableModel answersTableModel, java.lang.String startString)
           
 VariableNameChecker.VariableInfo getVariableInfo()
           
static boolean makeSureVariableExists(Page p, boolean createVariablesFresh, VariableNameChecker.ModifiedVariableInfo variableInfo)
           
static boolean makeSureVariableExists(Page p, VariableDataBitSet variable)
           
 boolean setASuggestedNameIfNecessary()
          Check if there is a variable name, and if there is none, put one in by default.
 void setSuggestedNameStart(java.lang.String suggestedNameStart)
          When a variable is blank and it sets a suggested name automatically, start the variable name with this.
 void setVariableAndPage(VariableDataBitSet variable, StringDataBit table, DataBitStorage objectStorage)
           
 void setVariableAndPage(VariableDataBitSet variable, StringDataBit table, DataTableModel answersTableModel, DataBitStorage objectStorage)
           
 void setVariableAndPage(VariableNameChecker.VariableInfo variableInfo, DataTableModel answersTableModel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableNameChecker

public VariableNameChecker()
Method Detail

setVariableAndPage

public void setVariableAndPage(VariableDataBitSet variable,
                               StringDataBit table,
                               DataBitStorage objectStorage)

setVariableAndPage

public void setVariableAndPage(VariableDataBitSet variable,
                               StringDataBit table,
                               DataTableModel answersTableModel,
                               DataBitStorage objectStorage)

setVariableAndPage

public void setVariableAndPage(VariableNameChecker.VariableInfo variableInfo,
                               DataTableModel answersTableModel)

getAnswersTable

public DataTableModel getAnswersTable()

getVariableInfo

public VariableNameChecker.VariableInfo getVariableInfo()

setSuggestedNameStart

public void setSuggestedNameStart(java.lang.String suggestedNameStart)
When a variable is blank and it sets a suggested name automatically, start the variable name with this. For example, if you want variables to be "question1", "question2", "question3", set this to "question" (which is the default).

Parameters:
suggestedNameStart -

setASuggestedNameIfNecessary

public boolean setASuggestedNameIfNecessary()
Check if there is a variable name, and if there is none, put one in by default. Call it "question1" or "question28" depending upon what other "question*" are in use. Always have a default.

Returns:
whether or not it put in a new name

getSuggestedName

public static java.lang.String getSuggestedName(DataTableModel answersTableModel)

getSuggestedName

public static java.lang.String getSuggestedName(DataTableModel answersTableModel,
                                                java.lang.String startString)

getSuggestedName

public java.lang.String getSuggestedName()

getAllVariablesFrom

public static java.util.Vector<VariableDataBitSet> getAllVariablesFrom(QuestionDataBitSet question)

getAllVariablesAsModifiedInfoFrom

public static java.util.Vector<VariableNameChecker.ModifiedVariableInfo> getAllVariablesAsModifiedInfoFrom(DataBitStorage objectStorage,
                                                                                                           StringDataBit answersTableName,
                                                                                                           QuestionDataBitSet question)

checkVariableNameForDuplicates

protected static PropertiesPanel.ErrorDetail checkVariableNameForDuplicates(java.lang.String variableName,
                                                                            Page page,
                                                                            int qNum,
                                                                            VariableDataBitSet variable,
                                                                            StringDataBit variableType,
                                                                            QuestionDataBitSet question2,
                                                                            DataTableModel answersTableModel)
Assumes you've already checked that the table names are the same (you should check them at the top of each page)

Parameters:
variableName -
page -
qNum -
variable -
question2 -
answersTableModel -
Returns:

checkVariableNameForDuplicates

protected static PropertiesPanel.ErrorDetail checkVariableNameForDuplicates(StringDataBit variableName,
                                                                            Page page,
                                                                            int qNum,
                                                                            VariableDataBitSet variable,
                                                                            StringDataBit variableType,
                                                                            QuestionDataBitSet question2,
                                                                            DataTableModel answersTable)

checkVariableNameForDuplicates

public PropertiesPanel.ErrorDetail checkVariableNameForDuplicates(StringDataBit variableName)

checkVariableNameForDuplicates

public static PropertiesPanel.ErrorDetail checkVariableNameForDuplicates(java.lang.String variableName,
                                                                         DataTableModel answersTableModel,
                                                                         DataBitStorage objectStorage)

checkVariableNameForDuplicates

public PropertiesPanel.ErrorDetail checkVariableNameForDuplicates()
Returns:

checkVariableNameForErrors

public PropertiesPanel.ErrorDetail checkVariableNameForErrors()

checkVariableForNonDuplicateErrors

public static PropertiesPanel.ErrorDetail checkVariableForNonDuplicateErrors(VariableNameChecker.VariableInfo variableInfo)

checkVariableForNonDuplicateErrors

public PropertiesPanel.ErrorDetail checkVariableForNonDuplicateErrors()

fixVariable

public boolean fixVariable(VariableDataBitSet variable,
                           StringDataBit tableName)

makeSureVariableExists

public static boolean makeSureVariableExists(Page p,
                                             VariableDataBitSet variable)

makeSureVariableExists

public static boolean makeSureVariableExists(Page p,
                                             boolean createVariablesFresh,
                                             VariableNameChecker.ModifiedVariableInfo variableInfo)