use of org.ccsds.schema.sois.seds.EntryListType in project CCDD by nasa.
the class CcddEDSHandler method addParameterContainer.
/**
********************************************************************************************
* Add the parameter container
*
* @param namespace
* name space
*
* @param tableInfo
* table information reference
*
* @param varColumn
* variable name column index (model coordinates)
*
* @param typeColumn
* data type column index (model coordinates)
*
* @param sizeColumn
* array size column index (model coordinates)
*
* @param minColumn
* minimum value column index (model coordinates)
*
* @param maxColumn
* maximum value column index (model coordinates)
*
* @param isTlmHeader
* true if this table represents the CCSDS telemetry header
*
* @param applicationID
* application ID
*
* @param ccsdsAppID
* name of the command header argument containing the application ID
********************************************************************************************
*/
private void addParameterContainer(NamespaceType namespace, TableInformation tableInfo, int varColumn, int typeColumn, int sizeColumn, int minColumn, int maxColumn, boolean isTlmHeader, // TODO WHERE DOES THIS GET PUT?
String applicationID, // TODO WHERE DOES THIS GET PUT?
String ccsdsAppID) {
ContainerDataType containerType = null;
EntryListType entryList = factory.createEntryListType();
// Step through each row of data in the structure table
for (String[] rowData : tableInfo.getData()) {
// used to create the list)
if (!ArrayVariable.isArrayMember(rowData[varColumn])) {
// TODO A REFERENCE IN A CONTAINER TO A STRUCTURE THAT CONTAINS AN ARRAY THROWS A
// NULL POINTER EXCEPTION IN THE EDS VIEWER (UNDER THE DATA TYPES TAB WHEN THE
// CONTAINER IS EXPANDED)
// Store the parameter reference in the list
EntryType entryType = factory.createEntryType();
entryType.setName(rowData[varColumn]);
entryType.setType(getReferenceByDataType(rowData[varColumn], rowData[typeColumn], !dataTypeHandler.isPrimitive(rowData[typeColumn])) + getObjectIdentifier(rowData[sizeColumn]));
// Check if a minimum or maximum value exists
if ((minColumn != -1 && !rowData[minColumn].isEmpty()) || (maxColumn != -1 && !rowData[maxColumn].isEmpty())) {
DerivedTypeRangeType range = factory.createDerivedTypeRangeType();
MinMaxRangeType minMaxRange = factory.createMinMaxRangeType();
minMaxRange.setRangeType(RangeType.INCLUSIVE_MIN_INCLUSIVE_MAX);
// Set the flag if the parameter is in integer data type
boolean isInteger = dataTypeHandler.isInteger(rowData[typeColumn]);
// Check if a minimum value is specified
if (minColumn != -1 && !rowData[minColumn].isEmpty()) {
// Set the minimum value
minMaxRange.setMin(isInteger ? BigDecimal.valueOf(Integer.valueOf(rowData[minColumn])) : BigDecimal.valueOf(Float.valueOf(rowData[minColumn])));
}
// Check if a maximum value is specified
if (maxColumn != -1 && !rowData[maxColumn].isEmpty()) {
// Set the maximum value
minMaxRange.setMax(isInteger ? BigDecimal.valueOf(Integer.valueOf(rowData[maxColumn])) : BigDecimal.valueOf(Float.valueOf(rowData[maxColumn])));
}
// Set the range
range.setMinMaxRange(minMaxRange);
entryType.setValidRange(range);
}
entryList.getEntryOrFixedValueEntryOrPaddingEntry().add(entryType);
}
}
// Check if any parameters exist
if (!entryList.getEntryOrFixedValueEntryOrPaddingEntry().isEmpty()) {
// Check if the parameter sequence container set hasn't been created
if (containerType == null) {
// Create the parameter sequence container set
containerType = factory.createContainerDataType();
}
// Check if this is the telemetry header
if (isTlmHeader) {
containerType.setName(tlmHeaderTable + TYPE);
containerType.setAbstract(true);
} else // Not the telemetry header
{
containerType.setName(tableInfo.getPrototypeName() + TYPE);
}
// Store the parameters in the parameter sequence container
containerType.setEntryList(entryList);
}
// Check if any parameters exist
if (containerType != null) {
// Get the data type set for this name space
DataTypeSetType dataTypeSet = namespace.getDataTypeSet();
// enumerated parameter
if (dataTypeSet == null) {
// Create the data type set
dataTypeSet = factory.createDataTypeSetType();
}
// Add the parameters to the system
dataTypeSet.getArrayDataTypeOrBinaryDataTypeOrBooleanDataType().add(containerType);
namespace.setDataTypeSet(dataTypeSet);
}
}
Aggregations