com.instantbank.lettertemplate.editor.web
Class VariablesManager

java.lang.Object
  |
  +--com.instantbank.lettertemplate.editor.web.VariablesManager

public class VariablesManager
extends java.lang.Object

Auxiliary class that manages the information related to variables.

Author:
InstantBank (Rodrigo Lopez)

Field Summary
static int CODE
          Code's position inside a variable's slot.
static long DEFAULT_DATE_FORMAT
           
static long DEFAULT_NUMBER_FORMAT
           
static long DEFAULT_STRING_FORMAT
           
static int NAME
          Name's position inside a variable's slot.
static int OFFSET
          Offset type's position inside a variable slot.
private  java.util.ArrayList theVars
          Variables related information: ArrayList of ArrayList of < code, name, type, dateOffsetType>
static int TYPE
          Type's position inside a variable's slot.
 
Constructor Summary
VariablesManager(java.util.ArrayList varsInfo)
          VariablesManager constructor.
 
Method Summary
 java.util.ArrayList assocCode(java.lang.Long code)
          Searches a variable --by its code-- inside the variable information structure.
 java.util.ArrayList assocName(java.lang.String name)
          Searches a variable --by its name-- inside the variable information structure.
 java.lang.String buildNameWithFormat(java.lang.Long varCode, java.lang.Long formatCode)
          Delivers an internal name for the variable.
 java.lang.Long getCode(java.lang.String name)
          Delivers the code of a variable, after its name.
 java.lang.String getName(java.lang.Long code)
          Delivers the variable's name, after its code.
 java.lang.String getOffsetType(java.lang.Long code)
          Delivers the type of offset for Date variables: "no", "workable", "chronological"
 java.lang.String getType(java.lang.Long code)
          Delivers the type of the variable, after its code.
 java.lang.String getType(java.lang.String name)
          Delivers the type of the variable, after its name.
 boolean isVarUndef(long code)
          Test if a variable code corresponds to the undefined value.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

DEFAULT_STRING_FORMAT

public static final long DEFAULT_STRING_FORMAT

DEFAULT_NUMBER_FORMAT

public static final long DEFAULT_NUMBER_FORMAT

DEFAULT_DATE_FORMAT

public static final long DEFAULT_DATE_FORMAT

theVars

private java.util.ArrayList theVars
Variables related information: ArrayList of ArrayList of < code, name, type, dateOffsetType>

CODE

public static final int CODE
Code's position inside a variable's slot.

NAME

public static final int NAME
Name's position inside a variable's slot.

TYPE

public static final int TYPE
Type's position inside a variable's slot.

OFFSET

public static final int OFFSET
Offset type's position inside a variable slot.
Constructor Detail

VariablesManager

public VariablesManager(java.util.ArrayList varsInfo)
VariablesManager constructor.
Parameters:
varsInfo - The variables info.
Method Detail

assocName

public java.util.ArrayList assocName(java.lang.String name)
Searches a variable --by its name-- inside the variable information structure.
Parameters:
name - Variable's name.
Returns:
  • The slot where the name is found.
  • Null if the name is not found.

assocCode

public java.util.ArrayList assocCode(java.lang.Long code)
Searches a variable --by its code-- inside the variable information structure.
Parameters:
code - The variable's code.
Returns:
  • The slot where the name is found.
  • Null if the name is not found.

getCode

public java.lang.Long getCode(java.lang.String name)
Delivers the code of a variable, after its name.
Parameters:
name -  
Returns:
The code, or "null" if it doesn't exist.

getName

public java.lang.String getName(java.lang.Long code)
Delivers the variable's name, after its code.
Parameters:
code -  
Returns:
The name of the variable, or "null" if the variable doesn't exist.

buildNameWithFormat

public java.lang.String buildNameWithFormat(java.lang.Long varCode,
                                            java.lang.Long formatCode)
Delivers an internal name for the variable.
Parameters:
varCode - The code of the variable.
formatCode - The code of the format.
Returns:
The internal name or null if the variable doesn't exist. The name is formed as:f<formatCode>_v<varCode>

getType

public java.lang.String getType(java.lang.String name)
Delivers the type of the variable, after its name.
Parameters:
name -  
Returns:
The type "D", "N" , "S" or null if the variable doesn't exist.

getType

public java.lang.String getType(java.lang.Long code)
Delivers the type of the variable, after its code.
Parameters:
code -  
Returns:
The type "D", "N" , "S" or null if the variable doesn't exist.

getOffsetType

public java.lang.String getOffsetType(java.lang.Long code)
Delivers the type of offset for Date variables: "no", "workable", "chronological"
Parameters:
code - Description of the Parameter
Returns:
The offsetType value

isVarUndef

public boolean isVarUndef(long code)
Test if a variable code corresponds to the undefined value.
Parameters:
code -  
Returns:
The varUndef value