/** * Returns the substance only derived {@link UnitDefinition} for the given {@link Species}. * * <p> Try to get the derived unit from the user objects first and store it there * for future usage if it is not there. * </p> * * @param sbase the sbase * @return the substance only derived {@link UnitDefinition} for the given {@link Species}. */ public static UnitDefinition getDerivedSubstanceUnitDefinition(Species sbase) { if (sbase.isSetUserObjects() && sbase.getUserObject(VALIDATION_CACHE_DERIVED_SUBSTANCE_UNIT_DEFINITION) != null) { return (UnitDefinition) sbase.getUserObject(VALIDATION_CACHE_DERIVED_SUBSTANCE_UNIT_DEFINITION); } UnitDefinition derivedUD = sbase.getDerivedSubstanceUnitDefinition(); sbase.putUserObject(VALIDATION_CACHE_DERIVED_SUBSTANCE_UNIT_DEFINITION, derivedUD); return derivedUD; }
UnitDefinition specUnit = getDerivedSubstanceUnitDefinition();