|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sei.aadl.model.properties.PropertyUtils
public class PropertyUtils
This class contains static methods for assisting in getting simple property values of specific types. These methods are convenient, but they can mask errors in the specification being analyzed because they cannot distinguish between a property value being not present and a property value begin modal or list-valued.
Method Summary | |
---|---|
static EnumValue |
createEnumValue(EnumLiteral enumValue)
Creates a PropertyValue for an enumeration. |
static IntegerRangeValue |
createIntegerRangeValue(long min,
long max)
Creates a PropertyValue for a range of aadlinteger. |
static IntegerRangeValue |
createIntegerRangeValue(long min,
long max,
long delta)
Creates a PropertyValue for a range of aadlinteger. |
static IntegerRangeValue |
createIntegerRangeValue(long min,
UnitLiteral minUnits,
long max,
UnitLiteral maxUnits)
Creates a PropertyValue for a range of aadlinteger with units. |
static IntegerRangeValue |
createIntegerRangeValue(long min,
UnitLiteral minUnits,
long max,
UnitLiteral maxUnits,
long delta,
UnitLiteral deltaUnits)
Creates a PropertyValue for a range of aadlinteger with units. |
static IntegerValue |
createIntegerValue(long intValue)
Creates a PropertyValue for an aadlinteger. |
static IntegerValue |
createIntegerValue(long intValue,
UnitLiteral unit)
Creates a PropertyValue for an aadlinteger with units. |
static RealRangeValue |
createRealRangeValue(double min,
double max)
Creates a PropertyValue for a range of aadlreal. |
static RealRangeValue |
createRealRangeValue(double min,
double max,
double delta)
Creates a PropertyValue for a range of aadlreal. |
static RealRangeValue |
createRealRangeValue(double min,
UnitLiteral minUnits,
double max,
UnitLiteral maxUnits)
Creates a PropertyValue for a range of aadlreal with units. |
static RealRangeValue |
createRealRangeValue(double min,
UnitLiteral minUnits,
double max,
UnitLiteral maxUnits,
double delta,
UnitLiteral deltaUnits)
Creates a PropertyValue for a range of aadlreal with units. |
static RealValue |
createRealValue(double realValue)
Creates a PropertyValue for an aadlreal. |
static RealValue |
createRealValue(double realValue,
UnitLiteral unit)
Creates a PropertyValue for an aadlreal with units. |
static StringValue |
createStringValue(java.lang.String stringValue)
Creates a PropertyValue for a string. |
static TrueFalseValue |
createTrueFalseValue(boolean boolValue)
Creates a PropertyValue for an aadlboolean. |
static UnitLiteral |
findUnitLiteral(PropertyDefinition pd,
java.lang.String literalname)
Retrieve the unit literal given a unit string for a property It is useful when calling getScaledValue methods that require the literal as object |
static boolean |
getBooleanValue(PropertyHolder ph,
PropertyDefinition pd)
Get a non-modal boolean property value. |
static boolean |
getBooleanValue(PropertyHolder ph,
PropertyDefinition pd,
boolean defaultVal)
Get a non-modal boolean property value. |
static EnumLiteral |
getEnumLiteral(PropertyHolder ph,
PropertyDefinition pd)
Get a non-modal enumeration property value. |
static InstanceObject |
getInstanceObjectReference(InstanceObject io,
PropertyDefinition pd)
Get an InstanceObject from an instance reference value. |
static long |
getIntegerValue(PropertyHolder ph,
PropertyDefinition pd)
Get a non-modal integer property value with no units. |
static long |
getIntegerValue(PropertyHolder ph,
PropertyDefinition pd,
long defaultVal)
Get a non-modal integer property value with no units. |
static double |
getRealValue(PropertyHolder ph,
PropertyDefinition pd)
Get a non-modal real property with no units Throws an exception if no property value exists or an error occurs. |
static double |
getRealValue(PropertyHolder ph,
PropertyDefinition pd,
double defaultVal)
Get a non-modal real property value with no units. |
static double |
getScaledNumberValue(PropertyHolder ph,
PropertyDefinition pd,
UnitLiteral unit)
Get a non-modal numeric property value scaled to the given unit. |
static double |
getScaledNumberValue(PropertyHolder ph,
PropertyDefinition pd,
UnitLiteral unit,
double defaultVal)
Get a non-modal numeric property value scaled to the given unit. |
static double |
getScaledRangeDelta(PropertyHolder ph,
PropertyDefinition pd,
UnitLiteral unit)
Return the delta value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeDelta(PropertyHolder ph,
PropertyDefinition pd,
UnitLiteral unit,
double defaultVal)
Return the delta value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeMaximum(PropertyHolder ph,
PropertyDefinition pd,
UnitLiteral unit)
Return the maximum value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeMaximum(PropertyHolder ph,
PropertyDefinition pd,
UnitLiteral unit,
double defaultVal)
Return the maximum value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeMinimum(PropertyHolder ph,
PropertyDefinition pd,
UnitLiteral unit)
Return the minimum value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeMinimum(PropertyHolder ph,
PropertyDefinition pd,
UnitLiteral unit,
double defaultVal)
Return the minimum value of a non-modal range property value scaled to a given unit. |
static java.lang.String |
getStringValue(PropertyHolder ph,
PropertyDefinition pd)
Get a non-modal string property value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static long getIntegerValue(PropertyHolder ph, PropertyDefinition pd, long defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.defaultVal
- The value to return if the property has no value.
public static long getIntegerValue(PropertyHolder ph, PropertyDefinition pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.
InvalidModelException
- Thrown if the property value cannot be retrieved because the
model is incomplete or otherwise invalid.
PropertyNotPresentException
- Thrown if the property is undefined for ph.
PropertyIsModalException
- Thrown if ph is modal and declarative.
java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of property reference
dependencies.
java.lang.IllegalArgumentException
- Thrown if ph or pd is null.
PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply to ph.
PropertyIsListException
- Thrown if the property is not scalar.
java.lang.ClassCastException
- Thrown if the retrieved value is not an integer value.public static double getRealValue(PropertyHolder ph, PropertyDefinition pd, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.defaultVal
- The value to return if the property has no value.
public static double getRealValue(PropertyHolder ph, PropertyDefinition pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.
InvalidModelException
- Thrown if the property value cannot be retrieved because the
model is incomplete or otherwise invalid.
PropertyNotPresentException
- Thrown if the property is undefined for ph.
PropertyIsModalException
- Thrown if ph is modal and declarative.
java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of property reference
dependencies.
java.lang.IllegalArgumentException
- Thrown if ph or pd is null.
PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply to ph.
PropertyIsListException
- Thrown if the property is not scalar.
java.lang.ClassCastException
- Thrown if the retrieved value is not a real value.public static java.lang.String getStringValue(PropertyHolder ph, PropertyDefinition pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.
InvalidModelException
- Thrown if the property value cannot be retrieved because the
model is incomplete or otherwise invalid.
PropertyNotPresentException
- Thrown if the property is undefined for ph.
PropertyIsModalException
- Thrown if ph is modal and declarative.
java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of property reference
dependencies.
java.lang.IllegalArgumentException
- Thrown if ph or pd is null.
PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply to ph.
PropertyIsListException
- Thrown if the property is not scalar.
java.lang.ClassCastException
- Thrown if the retrieved value is not a string value.public static boolean getBooleanValue(PropertyHolder ph, PropertyDefinition pd, boolean defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.defaultVal
- The value to return if the property has no value.
public static boolean getBooleanValue(PropertyHolder ph, PropertyDefinition pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.
InvalidModelException
- Thrown if the property value cannot be retrieved because the
model is incomplete or otherwise invalid.
PropertyNotPresentException
- Thrown if the property is undefined for ph.
PropertyIsModalException
- Thrown if ph is modal and declarative.
java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of property reference
dependencies.
java.lang.IllegalArgumentException
- Thrown if ph or pd is null.
PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply to ph.
PropertyIsListException
- Thrown if the property is not scalar.
java.lang.ClassCastException
- Thrown if the retrieved value is not a TrueFalseValue
value.public static EnumLiteral getEnumLiteral(PropertyHolder ph, PropertyDefinition pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.
InvalidModelException
- Thrown if the property value cannot be retrieved because the
model is incomplete or otherwise invalid.
PropertyNotPresentException
- Thrown if the property is undefined for ph.
PropertyIsModalException
- Thrown if ph is modal and declarative.
java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of property reference
dependencies.
java.lang.IllegalArgumentException
- Thrown if ph or pd is null.
PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply to ph.
PropertyIsListException
- Thrown if the property is not scalar.
java.lang.ClassCastException
- Thrown if the retrieved value is not an enumeration value.public static double getScaledNumberValue(PropertyHolder ph, PropertyDefinition pd, UnitLiteral unit, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.defaultVal
- The value to return if the property has no value.
public static double getScaledNumberValue(PropertyHolder ph, PropertyDefinition pd, UnitLiteral unit) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.
InvalidModelException
- Thrown if the property value cannot be retrieved because the
model is incomplete or otherwise invalid.
PropertyNotPresentException
- Thrown if the property is undefined for ph.
PropertyIsModalException
- Thrown if ph is modal and declarative.
java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of property reference
dependencies.
java.lang.IllegalArgumentException
- Thrown if the given unit literal is not from the property's
unit type or if ph, pd, or unit is null.
PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply to ph.
PropertyIsListException
- Thrown if the property is not scalar.
java.lang.ClassCastException
- Thrown if the retrieved value is not a number value.public static double getScaledRangeMaximum(PropertyHolder ph, PropertyDefinition pd, UnitLiteral unit, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.defaultVal
- The value to return if the property has no value.
public static double getScaledRangeMaximum(PropertyHolder ph, PropertyDefinition pd, UnitLiteral unit) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.
InvalidModelException
- Thrown if the property value cannot be retrieved because the
model is incomplete or otherwise invalid.
PropertyNotPresentException
- Thrown if the property is undefined for ph.
PropertyIsModalException
- Thrown if ph is modal and declarative.
java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of property reference
dependencies.
java.lang.IllegalArgumentException
- Thrown if the given unit literal is not from the property's
unit type or if ph, pd, or unit is null.
PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply to ph.
PropertyIsListException
- Thrown if the property is not scalar.
java.lang.ClassCastException
- Thrown if the retrieved value is not a range value.public static double getScaledRangeMinimum(PropertyHolder ph, PropertyDefinition pd, UnitLiteral unit, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.defaultVal
- The value to return if the property has no value.
public static double getScaledRangeMinimum(PropertyHolder ph, PropertyDefinition pd, UnitLiteral unit) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.
InvalidModelException
- Thrown if the property value cannot be retrieved because the
model is incomplete or otherwise invalid.
PropertyNotPresentException
- Thrown if the property is undefined for ph.
PropertyIsModalException
- Thrown if ph is modal and declarative.
java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of property reference
dependencies.
java.lang.IllegalArgumentException
- Thrown if the given unit literal is not from the property's
unit type or if ph, pd, or unit is null.
PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply to ph.
PropertyIsListException
- Thrown if the property is not scalar.
java.lang.ClassCastException
- Thrown if the retrieved value is not a range value.public static double getScaledRangeDelta(PropertyHolder ph, PropertyDefinition pd, UnitLiteral unit, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.defaultVal
- The value to return if the property has no value.
public static double getScaledRangeDelta(PropertyHolder ph, PropertyDefinition pd, UnitLiteral unit) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.
InvalidModelException
- Thrown if the property value cannot be retrieved because the
model is incomplete or otherwise invalid.
PropertyNotPresentException
- Thrown if the property is undefined for ph.
PropertyIsModalException
- Thrown if ph is modal and declarative.
java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of property reference
dependencies.
java.lang.IllegalArgumentException
- Thrown if the given unit literal is not from the property's
unit type or if ph, pd, or unit is null.
PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply to ph.
PropertyIsListException
- Thrown if the property is not scalar.
java.lang.ClassCastException
- Thrown if the retrieved value is not a range value.public static InstanceObject getInstanceObjectReference(InstanceObject io, PropertyDefinition pd)
io
- The instance objet from which to retrieve the property value.
(We don't use a property holder because we can only get an
instance reference value as a property value from an instance
object.)pd
- The property to retrieve.
public static IntegerValue createIntegerValue(long intValue)
public static IntegerValue createIntegerValue(long intValue, UnitLiteral unit) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if unit is null.public static IntegerRangeValue createIntegerRangeValue(long min, long max) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static IntegerRangeValue createIntegerRangeValue(long min, UnitLiteral minUnits, long max, UnitLiteral maxUnits) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if minUnits or maxUnits is null, if minUnits and maxUnits are not of the same UnitType, or if min is greater than max.public static IntegerRangeValue createIntegerRangeValue(long min, long max, long delta) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static IntegerRangeValue createIntegerRangeValue(long min, UnitLiteral minUnits, long max, UnitLiteral maxUnits, long delta, UnitLiteral deltaUnits) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if minUnits, maxUnits, or deltaUnits is null, if minUnits, maxUnits, and deltaUnits are not of the same UnitType, or if min is greater than max.public static RealValue createRealValue(double realValue)
public static RealValue createRealValue(double realValue, UnitLiteral unit) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if unit is null.public static RealRangeValue createRealRangeValue(double min, double max) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RealRangeValue createRealRangeValue(double min, UnitLiteral minUnits, double max, UnitLiteral maxUnits) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if minUnits or maxUnits is null, if minUnits and maxUnits are not of the same UnitType, or if min is greater than max.public static RealRangeValue createRealRangeValue(double min, double max, double delta) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RealRangeValue createRealRangeValue(double min, UnitLiteral minUnits, double max, UnitLiteral maxUnits, double delta, UnitLiteral deltaUnits) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if minUnits, maxUnits, or deltaUnits is null, if minUnits, maxUnits, and deltaUnits are not of the same UnitType, or if min is greater than max.public static StringValue createStringValue(java.lang.String stringValue) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if stringValue is null.public static TrueFalseValue createTrueFalseValue(boolean boolValue)
public static EnumValue createEnumValue(EnumLiteral enumValue) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if enumValue is null.public static UnitLiteral findUnitLiteral(PropertyDefinition pd, java.lang.String literalname)
pd
- Property Definitionliteralname
- String
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |