use of CCDD.CcddClassesDataTable.TableInformation in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getTableNumRows.
/**
********************************************************************************************
* Get the number of rows of data in the table for the specified table type
*
* @param tableType
* table type (case insensitive). All structure table types are combined and are
* referenced by the type name "Structure", and all command table types are combined
* and are referenced by the type name "Command"
*
* @return Number of rows of data in the table for the table type specified; -1 if an instance
* of the table type doesn't exist
********************************************************************************************
*/
public int getTableNumRows(String tableType) {
int numRows = -1;
// Get the reference to the table information class for the requested table type
TableInformation tableInfo = getTableInformation(tableType);
// Check that the table type exists
if (tableInfo != null) {
// Store the number of rows for the table
numRows = tableInfo.getData().length;
}
return numRows;
}
use of CCDD.CcddClassesDataTable.TableInformation in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getStructureVariableName.
/**
********************************************************************************************
* Get the variable name 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 name at the specified row in the structure data; null if the row index is
* invalid
********************************************************************************************
*/
private String getStructureVariableName(int row, boolean expandMacros) {
String variableName = 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 variable name
variableName = tableInfo.getData()[row][typeDefn.getColumnIndexByInputType(InputDataType.VARIABLE)];
// Check if any macros should be expanded
if (expandMacros) {
// Expand any macros
variableName = macroHandler.getMacroExpansion(variableName);
}
}
return variableName;
}
use of CCDD.CcddClassesDataTable.TableInformation in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getCommandArgMaximum.
/**
********************************************************************************************
* Get the argument maximum value (as a string) 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 maximum value (as a string) 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 getCommandArgMaximum(int argumentNumber, int row, boolean expandMacros) {
String argMaximum = 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 maximum value exists
if (argumentNumber < commandArguments.size() && commandArguments.get(argumentNumber).getMaximum() != -1) {
// Get the reference to the table information
TableInformation tableInfo = getTableInformation(TYPE_COMMAND);
// Get the argument maximum value
argMaximum = tableInfo.getData()[row][commandArguments.get(argumentNumber).getMaximum()];
// Check if any macros should be expanded
if (expandMacros) {
// Expand any macros
argMaximum = macroHandler.getMacroExpansion(argMaximum);
}
}
}
return argMaximum;
}
use of CCDD.CcddClassesDataTable.TableInformation in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getStructureBitLength.
/**
********************************************************************************************
* Get the variable bit length 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 bit length at the specified row in the structure data; null if the row
* index is invalid
********************************************************************************************
*/
private String getStructureBitLength(int row, boolean expandMacros) {
String bitLength = 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 bit length
bitLength = tableInfo.getData()[row][typeDefn.getColumnIndexByInputType(InputDataType.BIT_LENGTH)];
// Check if any macros should be expanded
if (expandMacros) {
// Expand any macros
bitLength = macroHandler.getMacroExpansion(bitLength);
}
}
return bitLength;
}
use of CCDD.CcddClassesDataTable.TableInformation in project CCDD by nasa.
the class CcddScriptDataAccessHandler method getCommandArgEnumeration.
/**
********************************************************************************************
* Get the argument enumeration 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 enumeration 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 getCommandArgEnumeration(int argumentNumber, int row, boolean expandMacros) {
String argEnumeration = 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 enumeration exists
if (argumentNumber < commandArguments.size() && commandArguments.get(argumentNumber).getEnumeration() != -1) {
// Get the reference to the table information
TableInformation tableInfo = getTableInformation(TYPE_COMMAND);
// Get the argument enumeration
argEnumeration = tableInfo.getData()[row][commandArguments.get(argumentNumber).getEnumeration()];
// Check if any macros should be expanded
if (expandMacros) {
// Expand any macros
argEnumeration = macroHandler.getMacroExpansion(argEnumeration);
}
}
}
return argEnumeration;
}
Aggregations