sbr.resources
Class Convert

java.lang.Object
  extended by sbr.resources.Convert

public class Convert
extends java.lang.Object

Classes to do needed conversions within SurveyBuildR

Version:
0.3
Author:
John H. Krantz, Ph.D.

Field Summary
static int FALSE
          Integer code for boolean false (=1).
static int TRUE
          Integer code for boolean true (=0).
 
Constructor Summary
Convert()
           
 
Method Summary
 java.lang.String convertVarNum(int varNum)
          Converts a number in to a string for the variable name.
 int fromBoolean(boolean tf)
          Converts from a boolean to the integer codes used to store in text variables and files in SurveyBuildR.
 boolean toBoolean(int tf)
          Converts integer codes used to store in strings and files by SurveyBuildR back to their boolean counter parts.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final int TRUE
Integer code for boolean true (=0).

See Also:
Constant Field Values

FALSE

public static final int FALSE
Integer code for boolean false (=1).

See Also:
Constant Field Values
Constructor Detail

Convert

public Convert()
Method Detail

convertVarNum

public java.lang.String convertVarNum(int varNum)
Converts a number in to a string for the variable name. The format is 000var (the number is given leading 0's till it is 3 digits long). This conversion is done to help order variables when saved. This is not the same as the question number as there are hidden variables in the survey.

Parameters:
varNum - the number of the variable.
Returns:
String nV. The converted variable number.

toBoolean

public boolean toBoolean(int tf)
Converts integer codes used to store in strings and files by SurveyBuildR back to their boolean counter parts. A 0 - true and a 1 = false.

Parameters:
tf - The boolean code.
Returns:
boolean. The boolean form.

fromBoolean

public int fromBoolean(boolean tf)
Converts from a boolean to the integer codes used to store in text variables and files in SurveyBuildR. A 0 - true and a 1 = false.

Parameters:
tf - the boolean variable to be coded.
Returns:
int. The integer code.