|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sei.aadl.modelsupport.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 being modal or list-valued.
Method Summary | |
---|---|
static EnumerationValue |
createEnumValue(EnumerationLiteral literal)
Create a enumeration value from an enumeration literal. |
static RangeValue |
createIntegerRangeValue(long min,
long max)
Creates a PropertyValue for a range of aadlinteger. |
static RangeValue |
createIntegerRangeValue(long min,
long max,
long delta)
Creates a PropertyValue for a range of aadlinteger. |
static RangeValue |
createIntegerRangeValue(long min,
UnitLiteral minUnits,
long max,
UnitLiteral maxUnits)
Creates a PropertyValue for a range of aadlinteger with units. |
static RangeValue |
createIntegerRangeValue(long min,
UnitLiteral minUnits,
long max,
UnitLiteral maxUnits,
long delta,
UnitLiteral deltaUnits)
Creates a PropertyValue for a range of aadlinteger with units. |
static IntegerLiteral |
createIntegerValue(long intValue)
Creates a PropertyValue for an aadlinteger. |
static IntegerLiteral |
createIntegerValue(long intValue,
UnitLiteral unit)
Creates a PropertyValue for an aadlinteger with units. |
static RangeValue |
createRealRangeValue(double min,
double max)
Creates a PropertyValue for a range of aadlreal. |
static RangeValue |
createRealRangeValue(double min,
double max,
double delta)
Creates a PropertyValue for a range of aadlreal. |
static RangeValue |
createRealRangeValue(double min,
UnitLiteral minUnits,
double max,
UnitLiteral maxUnits)
Creates a PropertyValue for a range of aadlreal with units. |
static RangeValue |
createRealRangeValue(double min,
UnitLiteral minUnits,
double max,
UnitLiteral maxUnits,
double delta,
UnitLiteral deltaUnits)
Creates a PropertyValue for a range of aadlreal with units. |
static RealLiteral |
createRealValue(double realValue)
Creates a PropertyValue for an aadlreal. |
static RealLiteral |
createRealValue(double realValue,
UnitLiteral unit)
Creates a PropertyValue for an aadlreal with units. |
static StringLiteral |
createStringValue(java.lang.String stringValue)
Creates a PropertyValue for a string. |
static BooleanLiteral |
createTrueFalseValue(boolean boolValue)
Creates a PropertyValue for an aadlboolean. |
static UnitLiteral |
findUnitLiteral(Property 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(NamedElement ph,
Property pd)
Get a non-modal boolean property value. |
static boolean |
getBooleanValue(NamedElement ph,
Property pd,
boolean defaultVal)
Get a non-modal boolean property value. |
static Classifier |
getClassifierReference(NamedElement ph,
Property pd)
|
static EnumerationLiteral |
getEnumLiteral(NamedElement ph,
Property pd)
Get a non-modal enumeration property value. |
static InstanceObject |
getInstanceObjectReference(InstanceObject io,
Property pd)
Get an InstanceObject from an instance reference value. |
static long |
getIntegerValue(NamedElement ph,
Property pd)
Get a non-modal integer property value with no units. |
static long |
getIntegerValue(NamedElement ph,
Property pd,
long defaultVal)
Get a non-modal integer property value with no units. |
static double |
getRealValue(NamedElement ph,
Property 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(NamedElement ph,
Property pd,
double defaultVal)
Get a non-modal real property value with no units. |
static double |
getScaledNumberValue(NamedElement ph,
Property pd,
UnitLiteral unit)
Get a non-modal numeric property value scaled to the given unit. |
static double |
getScaledNumberValue(NamedElement ph,
Property pd,
UnitLiteral unit,
double defaultVal)
Get a non-modal numeric property value scaled to the given unit. |
static double |
getScaledRangeDelta(NamedElement ph,
Property pd,
UnitLiteral unit)
Return the delta value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeDelta(NamedElement ph,
Property pd,
UnitLiteral unit,
double defaultVal)
Return the delta value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeMaximum(NamedElement ph,
Property pd,
UnitLiteral unit)
Return the maximum value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeMaximum(NamedElement ne,
Property pd,
UnitLiteral unit,
double defaultVal)
Return the maximum value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeMinimum(NamedElement ph,
Property pd,
UnitLiteral unit)
Return the minimum value of a non-modal range property value scaled to a given unit. |
static double |
getScaledRangeMinimum(NamedElement ph,
Property 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(NamedElement ph,
Property 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(NamedElement ph, Property 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(NamedElement ph, Property 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(NamedElement ph, Property 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(NamedElement ph, Property 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(NamedElement ph, Property pd)
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(NamedElement ph, Property 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(NamedElement ph, Property 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 EnumerationLiteral getEnumLiteral(NamedElement ph, Property 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(NamedElement ph, Property 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(NamedElement ph, Property 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(NamedElement ne, Property 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(NamedElement ph, Property 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(NamedElement ph, Property 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(NamedElement ph, Property 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(NamedElement ph, Property 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(NamedElement ph, Property 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, Property pd)
io
- The instance object 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 Classifier getClassifierReference(NamedElement ph, Property pd)
public static IntegerLiteral createIntegerValue(long intValue)
public static IntegerLiteral createIntegerValue(long intValue, UnitLiteral unit) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if unit is null.public static RangeValue createIntegerRangeValue(long min, long max) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RangeValue 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 RangeValue createIntegerRangeValue(long min, long max, long delta) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RangeValue 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 RealLiteral createRealValue(double realValue)
public static RealLiteral createRealValue(double realValue, UnitLiteral unit) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if unit is null.public static RangeValue createRealRangeValue(double min, double max) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RangeValue 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 RangeValue createRealRangeValue(double min, double max, double delta) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RangeValue 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 StringLiteral createStringValue(java.lang.String stringValue) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if stringValue is null.public static BooleanLiteral createTrueFalseValue(boolean boolValue)
public static EnumerationValue createEnumValue(EnumerationLiteral literal) throws java.lang.IllegalArgumentException
literal
- The enumeration literal
java.lang.IllegalArgumentException
- Thrown if literal is nullpublic static UnitLiteral findUnitLiteral(Property 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 |