edu.cmu.sei.aadl.model.properties
Interface ModalPropertyValue

All Known Subinterfaces:
ModalPropertyValueAccumulator
All Known Implementing Classes:
DeclarativeMPVA, InstanceMPVA, ModalPropertyValueAccumulatorImpl

public interface ModalPropertyValue

Objects of this class encapsulate the property value for a particular property of a particular PropertyHolder element. They are returned by PropertyHolder.getPropertyValue(edu.cmu.sei.aadl.model.property.PropertyDefinition). The primary purpose of this method is to bundle together all the values the property may have depending on the mode state of the property holder and its containers.

The ComponentImplelements whose mode bindings can influence the value of the property are referred to as mode contexts . They can be obtained by using the getModeContexts()and getModeContextsAsArray()methods. To get the property value for specific mode bindings, use the getValue(Map)method, which takes a map from ComponentImplobjects to Modeobjects. In general, there may be a different value for each mode that each mode context can be in. The method getAllModeBindings()returns a collection of all the possible mode bindings as maps suitable for use with getValue. The method getValue(Map)returns an AadlPropertyValueobject that further encapsuales the value of the property.

A quick way to get all the values that the property can have depending on the mode is to use getAllValues()which returns a set of ReflectiveAadlPropertyValueobjects, one for each possible mode binding. To find the mode binding that produces a particular value use ReflectiveAadlPropertyValue.getModeBinding().

Author:
aarong

Method Summary
 java.util.Collection getAllModeBindings()
          Get all the mode contexts that are applicable to this value.
 java.util.Collection getAllValues()
          Get all the values the property value could have.
 java.util.Set getModeContexts()
          Get the components whose modes may affect this value.
 ModeContext[] getModeContextsAsArray()
          Get the components whose modes may affect this value.
 AadlPropertyValue getValue()
          Get the property value in the empty mode context.
 AadlPropertyValue getValue(java.util.Map modes)
          Get the property value based on the given mode settings.
 boolean isModal()
          Query if the property value may depend on modes.
 

Method Detail

isModal

boolean isModal()
Query if the property value may depend on modes. Currently, this is equivalent to checking if the set returned by getModeContexts() is not empty.

Returns:
true iff the propery value depends on modes.

getModeContexts

java.util.Set getModeContexts()
Get the components whose modes may affect this value.

Returns:
An immutable set of ModeContext objects.

getModeContextsAsArray

ModeContext[] getModeContextsAsArray()
Get the components whose modes may affect this value.

Returns:
A fresh array containing the objects.

getValue

AadlPropertyValue getValue(java.util.Map modes)
                           throws ModeNotSpecifiedException,
                                  InvalidModelException
Get the property value based on the given mode settings.

Parameters:
modes - The mode settings to use as a map from ModeContext objects to Mode objects. The domain of the mapping is given by the getModeContexts() method.
Returns:
The property value in the given modes.
Throws:
ModeNotSpecifiedException - Thrown if a mode value is not specified for one of the required modes.
InvalidModelException - thrown if an error in the model prevents the successful lookup of the property value. This exception is primarily of interest to the OSATE implementation which catches it during certain operations to report that the model has errors. (There are a few cases where the error can only be detected by looking up the property value.)

getValue

AadlPropertyValue getValue()
                           throws ModeNotSpecifiedException,
                                  InvalidModelException
Get the property value in the empty mode context.

Returns:
The property value in the given modes.
Throws:
ModeNotSpecifiedException - Thrown if a mode value is not speficied for one of the required modes.
InvalidModelException - thrown if an error in the model prevents the successful lookup of the property value. This exception is primarily of interest to the OSATE implementation which catches it during certain operations to report that the model has errors. (There are a few cases where the error can only be detected by looking up the property value.)

getAllModeBindings

java.util.Collection getAllModeBindings()
Get all the mode contexts that are applicable to this value. This is derived from the components returned by getModeContexts().

Returns:
A collection of Maps, enumerating all the possible combinations of modes that apply to the lookup of the value.

getAllValues

java.util.Collection getAllValues()
                                  throws InvalidModelException
Get all the values the property value could have.

Returns:
A collection of ReflectiveAadlPropertyValue objects, one for each valid combination of modes as determined by the mode contexts.
Throws:
InvalidModelException - thrown if an error in the model prevents the successful lookup of the property value. This exception is primarily of interest to the OSATE implementation which catches it during certain operations to report that the model has errors. (There are a few cases where the error can only be detected by looking up the property value.)