edu.cmu.sei.aadl.model.properties
Class ListPropertyValue

java.lang.Object
  extended by edu.cmu.sei.aadl.model.properties.AbstractAadlPropertyValue
      extended by edu.cmu.sei.aadl.model.properties.ListPropertyValue
All Implemented Interfaces:
AadlPropertyValue

public final class ListPropertyValue
extends AbstractAadlPropertyValue
implements AadlPropertyValue

Representation of a existent, present property value.

Author:
aarong

Constructor Summary
ListPropertyValue(java.util.List val, java.util.List definingAssocs)
          Create a new property value.
 
Method Summary
 AadlPropertyValue evaluate(PropertyHolder context, java.util.Map modes)
          Evaluate a property value in the given context and with the given mode bindings.
 boolean exists()
          Does the value exist at all?
 PropertyValue getScalarValue()
          Get the scalar value of the property.
 java.util.List getValue()
          Get the value of the property.
 int hashCode()
           
 AadlPropertyValue instantiate(ComponentInstance root)
          Update the property value so that it makes sense in an instance model.
 boolean isList()
          Is the value a list value?
 boolean isNotPresent()
          Is the value not present.
static ListPropertyValue newEmptyList(PropertyDefinition pd)
           
 java.util.Set preEvaluate(PropertyHolder context)
          Determine which modes this value may depend on.
 
Methods inherited from class edu.cmu.sei.aadl.model.properties.AbstractAadlPropertyValue
equals, getDefiningAssociations
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.cmu.sei.aadl.model.properties.AadlPropertyValue
getDefiningAssociations
 

Constructor Detail

ListPropertyValue

public ListPropertyValue(java.util.List val,
                         java.util.List definingAssocs)
Create a new property value.

Parameters:
val - The value as a list. Cannot be null.
Throws:
java.lang.NullPointerException - Thrown if val is null.
Method Detail

newEmptyList

public static ListPropertyValue newEmptyList(PropertyDefinition pd)

hashCode

public int hashCode()
Specified by:
hashCode in class AbstractAadlPropertyValue

exists

public boolean exists()
Description copied from interface: AadlPropertyValue
Does the value exist at all? A value does not exist if the component does not exist in the particular mode. This is not the same as the value being not present, which indicates that the property value is not set for the component in the given mode.

Specified by:
exists in interface AadlPropertyValue
Returns:
true if the value exists.
See Also:
AadlPropertyValue.isNotPresent()

isNotPresent

public boolean isNotPresent()
Description copied from interface: AadlPropertyValue
Is the value not present.

Specified by:
isNotPresent in interface AadlPropertyValue
Returns:
true if the value is "not present". A non existent property value is not "not present", and thus this returns false if the AadlPropertyValue.exists()is false.

isList

public boolean isList()
Description copied from interface: AadlPropertyValue
Is the value a list value?

Specified by:
isList in interface AadlPropertyValue
Returns:
true if the value is a list. Returns false if AadlPropertyValue.exists()or AadlPropertyValue.isNotPresent()is true.

getValue

public java.util.List getValue()
Description copied from interface: AadlPropertyValue
Get the value of the property.

Specified by:
getValue in interface AadlPropertyValue
Returns:
The value of the property as an immutable list. If the value does not exist or is not present this returns null. If AadlPropertyValue.isList()is false then this list is a one-element list, whose first (and only) element is the property value. Otherwise, the returned list is the property value.

getScalarValue

public PropertyValue getScalarValue()
Description copied from interface: AadlPropertyValue
Get the scalar value of the property.

Specified by:
getScalarValue in interface AadlPropertyValue
Returns:
The scalar value. If the value does not exist or is not present this returns null.

preEvaluate

public java.util.Set preEvaluate(PropertyHolder context)
                          throws InvalidModelException
Description copied from interface: AadlPropertyValue
Determine which modes this value may depend on.

Specified by:
preEvaluate in interface AadlPropertyValue
Parameters:
context - The element this value comes from.
Returns:
The model elements whose modes influence the value
Throws:
InvalidModelException - Thrown if the property value cannot be pre-evaluated because the model is incomplete or malformed.

evaluate

public AadlPropertyValue evaluate(PropertyHolder context,
                                  java.util.Map modes)
                           throws InvalidModelException
Description copied from interface: AadlPropertyValue
Evaluate a property value in the given context and with the given mode bindings.

Specified by:
evaluate in interface AadlPropertyValue
Parameters:
context - The element any property references should be looked up against.
modes - A map from ComponentImpl to Modedefining the mode bindings to use for the evaluation.
Returns:
The evaluated property value.
Throws:
InvalidModelException - Thrown if the property value cannot be evaluated because the model is incomplete or malformed.

instantiate

public AadlPropertyValue instantiate(ComponentInstance root)
                              throws InvalidModelException
Description copied from interface: AadlPropertyValue
Update the property value so that it makes sense in an instance model. For example, ReferencePropertyValue objects are replaced with InstanceReferencePropertyValue objects.

Specified by:
instantiate in interface AadlPropertyValue
Parameters:
root - The component instance to be used as the root of subcomponent paths. (This is also the component whose declared modes may be used in any in modes clauses.)
Returns:
The instantiated property value.
Throws:
InvalidModelException - Thrown if the property value cannot be instantiated because the model is incomplete or malformed.