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

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

public final class BogusPropertyValue
extends AbstractAadlPropertyValue
implements AadlPropertyValue

Property value that is returned when the model is out of whack. Allows analysis to keep running. This was necessitated because of the way the AadlPropertyCheckSwitch works. Only one instance of this class is needed, and thus this implementation uses the prototype pattern. The single instance can be obtained from the static PROTOTYPE field.

Author:
aarong

Field Summary
static BogusPropertyValue PROTOTYPE
          The singleton reference.
 
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.
 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
 

Field Detail

PROTOTYPE

public static final BogusPropertyValue PROTOTYPE
The singleton reference.

Method Detail

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)
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

evaluate

public AadlPropertyValue evaluate(PropertyHolder context,
                                  java.util.Map modes)
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.

instantiate

public AadlPropertyValue instantiate(ComponentInstance root)
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.