Search in sources :

Example 1 with SemanticsType

use of org.ccsds.schema.sois.seds.SemanticsType in project CCDD by nasa.

the class CcddEDSHandler method setUnits.

/**
 ********************************************************************************************
 * Set the supplied type's units from the supplied units string
 *
 * @param units
 *            parameter or command argument units; null to not specify
 *
 * @param type
 *            reference to the numeric data type in which to place the units information
 ********************************************************************************************
 */
private void setUnits(String units, NumericDataType type) {
    try {
        // This throws an illegal argument exception if the unit is not one of those in the
        // Unit enum class
        Unit unit = Unit.fromValue(units);
        SemanticsType semType = factory.createSemanticsType();
        semType.setUnit(unit);
        type.setSemantics(semType);
    } catch (IllegalArgumentException iae) {
    // User-supplied units don't match one of the hard-coded Unit types (from Units.java),
    // which are the only ones that are accepted by the Unit fromValue() method. The
    // hard-coded unit types list is limited
    }
}
Also used : SemanticsType(org.ccsds.schema.sois.seds.SemanticsType) Unit(org.ccsds.schema.sois.seds.Unit)

Aggregations

SemanticsType (org.ccsds.schema.sois.seds.SemanticsType)1 Unit (org.ccsds.schema.sois.seds.Unit)1