/** * Checks whether or not a given identifier for a {@link Kind} or * {@link UnitDefinition} equals a predefined unit identifier for this type. * * @param unitsID the identifier to be checked. * @return {@code true} if the given identifier equals the unit definition * identifier that is predefined under the Level/Version combination * for this data type. */ public boolean isPredefinedUnitsID(String unitsID) { if (unitsID != null) { String predefID = getPredefinedUnitID(); return (predefID != null) && unitsID.equals(predefID); } return false; }
@Override public String getDerivedUnits() { if (isSetUnits()) { return unitsID; } String predef = getPredefinedUnitID(); // System.out.println("AbstractNamedSBaseWithUnit - getDerivedUnits " + getElementName() + " - predef = " + predef); return predef != null ? predef : ""; }
@Override public UnitDefinition getUnitsInstance() { String unitsId = unitsID; if (isSetUnits()) { int level = getLevel(), version = getVersion(); if (Unit.isUnitKind(unitsId, level, version)) { UnitDefinition ud = new UnitDefinition(unitsId + UnitDefinition.BASE_UNIT_SUFFIX, level, version); ud.addUnit(Unit.Kind.valueOf(unitsId.toUpperCase())); return ud; } } else { unitsId = getPredefinedUnitID(); } Model model = getModel(); return model == null ? null : model.getUnitDefinition(unitsId); }