use of CCDD.CcddTableTypeHandler.TypeDefinition in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getStructureUnits.
/**
********************************************************************************************
* Get the variable units at the specified row in the structure data. Macro expansion is
* controlled by the input flag
*
* @param row
* table data row index
*
* @param expandMacros
* true to replace any macros with their corresponding value; false to return the
* data with any macro names in place
*
* @return Variable units at the specified row in the structure data; null if the row index is
* invalid or no column has the 'Units' input type
********************************************************************************************
*/
private String getStructureUnits(int row, boolean expandMacros) {
String units = null;
// Get the table type definition for the structure table referenced in the specified row
TypeDefinition typeDefn = tableTypeHandler.getTypeDefinition(getStructureTypeNameByRow(row));
// Check if the table type exists and represents a structure
if (typeDefn != null && typeDefn.isStructure()) {
// Get the reference to the table information
TableInformation tableInfo = getTableInformation(TYPE_STRUCTURE);
// Get the index of the first column with the 'Units' input type
int column = typeDefn.getColumnIndexByInputType(InputDataType.UNITS);
// Check if the column exists
if (column != -1) {
// Get the units
units = tableInfo.getData()[row][column];
// Check if any macros should be expanded
if (expandMacros) {
// Expand any macros
units = macroHandler.getMacroExpansion(units);
}
}
}
return units;
}
use of CCDD.CcddTableTypeHandler.TypeDefinition in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getStructureDataType.
/**
********************************************************************************************
* Get the variable data type at the specified row in the structure data
*
* @param row
* table data row index
*
* @return Variable data type at the specified row in the structure data; null if the row index
* is invalid
********************************************************************************************
*/
public String getStructureDataType(int row) {
String dataType = null;
// Get the table type definition for the structure table referenced in the specified row
TypeDefinition typeDefn = tableTypeHandler.getTypeDefinition(getStructureTypeNameByRow(row));
// Check if the table type exists and represents a structure
if (typeDefn != null && typeDefn.isStructure()) {
// Get the reference to the table information
TableInformation tableInfo = getTableInformation(TYPE_STRUCTURE);
// Get the data type
dataType = tableInfo.getData()[row][typeDefn.getColumnIndexByInputType(InputDataType.PRIM_AND_STRUCT)];
}
return dataType;
}
use of CCDD.CcddTableTypeHandler.TypeDefinition in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getStructureArraySize.
/**
********************************************************************************************
* Get the variable array size at the specified row in the structure data. Macro expansion is
* controlled by the input flag
*
* @param row
* table data row index
*
* @param expandMacros
* true to replace any macros with their corresponding value; false to return the
* data with any macro names in place
*
* @return Variable array size at the specified row in the structure data; null if the row
* index is invalid
********************************************************************************************
*/
private String getStructureArraySize(int row, boolean expandMacros) {
String arraySize = null;
// Get the table type definition for the structure table referenced in the specified row
TypeDefinition typeDefn = tableTypeHandler.getTypeDefinition(getStructureTypeNameByRow(row));
// Check if the table type exists and represents a structure
if (typeDefn != null && typeDefn.isStructure()) {
// Get the reference to the table information
TableInformation tableInfo = getTableInformation(TYPE_STRUCTURE);
// Get the array size
arraySize = tableInfo.getData()[row][typeDefn.getColumnIndexByInputType(InputDataType.ARRAY_INDEX)];
// Check if any macros should be expanded
if (expandMacros) {
// Expand any macros
arraySize = macroHandler.getMacroExpansion(arraySize);
}
}
return arraySize;
}
use of CCDD.CcddTableTypeHandler.TypeDefinition in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getStructureEnumerations.
/**
********************************************************************************************
* Get the variable enumeration(s) at the specified row in the structure data. Macro expansion
* is controlled by the input flag
*
* @param row
* table data row index
*
* @param expandMacros
* true to replace any macros with their corresponding value; false to return the
* data with any macro names in place
*
* @return Array containing the variable enumeration(s) at the specified row in the structure
* data; null if the row index is invalid
********************************************************************************************
*/
private String[] getStructureEnumerations(int row, boolean expandMacros) {
List<String> enumerations = new ArrayList<String>();
// Get the table type definition for the structure table referenced in the specified row
TypeDefinition typeDefn = tableTypeHandler.getTypeDefinition(getStructureTypeNameByRow(row));
// Check if the table type exists and represents a structure
if (typeDefn != null && typeDefn.isStructure()) {
// Get the reference to the table information
TableInformation tableInfo = getTableInformation(TYPE_STRUCTURE);
// Step through each enumeration column
for (int enumIndex : typeDefn.getColumnIndicesByInputType(InputDataType.ENUMERATION)) {
// Get the enumeration
String enumeration = tableInfo.getData()[row][enumIndex];
// Check if any macros should be expanded
if (expandMacros) {
// Expand any macros
enumeration = macroHandler.getMacroExpansion(enumeration);
}
// Add the enumeration to the list
enumerations.add(enumeration);
}
}
return enumerations.toArray(new String[0]);
}
use of CCDD.CcddTableTypeHandler.TypeDefinition in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getCommandArgBitLength.
/**
********************************************************************************************
* Get the argument bit length for the command argument specified at the specified row in the
* command data. Macro expansion is controlled by the input flag
*
* @param argumentNumber
* command argument index. The first argument is 0
*
* @param row
* table data row index
*
* @param expandMacros
* true to replace any macros with their corresponding value; false to return the
* data with any macro names in place
*
* @return Argument bit length for the command argument specified at the specified row in the
* command data; null if the argument number or row index is invalid
********************************************************************************************
*/
private String getCommandArgBitLength(int argumentNumber, int row, boolean expandMacros) {
String argBitLength = null;
// Get the table type definition for the command table referenced in the specified row
TypeDefinition typeDefn = tableTypeHandler.getTypeDefinition(getCommandTypeNameByRow(row));
// Check if the table type exists and represents a command
if (typeDefn != null && typeDefn.isCommand()) {
// Get the list of command arguments associated with this command table type
List<AssociatedColumns> commandArguments = typeDefn.getAssociatedCommandArgumentColumns(false);
// Check if the argument number is valid and that the argument bit length exists
if (argumentNumber < commandArguments.size() && commandArguments.get(argumentNumber).getBitLength() != -1) {
// Get the reference to the table information
TableInformation tableInfo = getTableInformation(TYPE_COMMAND);
// Get the argument bit length
argBitLength = tableInfo.getData()[row][commandArguments.get(argumentNumber).getBitLength()];
// Check if any macros should be expanded
if (expandMacros) {
// Expand any macros
argBitLength = macroHandler.getMacroExpansion(argBitLength);
}
}
}
return argBitLength;
}
Aggregations