edu.cmu.sei.aadl.model.property.impl
Class NumberValueImpl

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      extended by org.eclipse.emf.ecore.impl.BasicEObjectImpl
          extended by org.eclipse.emf.ecore.impl.EObjectImpl
              extended by edu.cmu.sei.aadl.model.core.impl.AObjectImpl
                  extended by edu.cmu.sei.aadl.model.property.impl.PropertyValueImpl
                      extended by edu.cmu.sei.aadl.model.property.impl.NumberValueImpl
All Implemented Interfaces:
AObject, NumberOrPropertyReference, NumberValue, PropertyValue, org.eclipse.core.runtime.IAdaptable, org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.InternalEObject
Direct Known Subclasses:
IntegerValueImpl, RealValueImpl

public class NumberValueImpl
extends PropertyValueImpl
implements NumberValue

An implementation of the model object 'Number Value'.

The following features are implemented:


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
org.eclipse.emf.ecore.impl.BasicEObjectImpl.EPropertiesHolder, org.eclipse.emf.ecore.impl.BasicEObjectImpl.EPropertiesHolderBaseImpl, org.eclipse.emf.ecore.impl.BasicEObjectImpl.EPropertiesHolderImpl
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E extends java.lang.Object & org.eclipse.emf.common.notify.Adapter>
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject
org.eclipse.emf.ecore.InternalEObject.EStore
 
Field Summary
static java.lang.String copyright
           
protected static char MINUS
           
protected  ParsedPropertyReference parsedPropertyReference
          the parsed property reference namesfor the constant reference
protected  ParsedPropertyReference parsedUnitLiteralReference
          the parsed property reference names for the unit literal
protected static char PLUS
           
protected  UnitLiteral unitLiteral
          The cached value of the 'Unit Literal' reference
protected static java.lang.String VALUE_STRING_EDEFAULT
          The default value of the 'Value String' attribute
protected  java.lang.String valueString
          The cached value of the 'Value String' attribute
 
Fields inherited from class edu.cmu.sei.aadl.model.core.impl.AObjectImpl
comment, locationReference
 
Fields inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
eAdapters, eContainer, eContainerFeatureID, EDELIVER, EDYNAMIC_CLASS, eFlags, ELAST_EOBJECT_FLAG, ELAST_NOTIFIER_FLAG, eProperties, EPROXY
 
Fields inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
EVIRTUAL_GET, EVIRTUAL_IS_SET, EVIRTUAL_NO_VALUE, EVIRTUAL_SET, EVIRTUAL_UNSET
 
Fields inherited from interface org.eclipse.emf.ecore.InternalEObject
EOPPOSITE_FEATURE_BASE
 
Constructor Summary
protected NumberValueImpl()
           
 
Method Summary
 UnitLiteral basicGetUnitLiteral()
           
 NumberValue cloneAndInvert()
          Create a "clone" that inverts this value.
 NumberValue cloneNumber()
          Clone this number value.
 java.lang.Object eGet(int featureID, boolean resolve, boolean coreType)
           
 boolean eIsSet(int featureID)
           
 void eSet(int featureID, java.lang.Object newValue)
           
protected  org.eclipse.emf.ecore.EClass eStaticClass()
           
 void eUnset(int featureID)
           
 AadlPropertyValue evaluate(PropertyHolder context, java.util.Map modes)
          Evaluate a property value.
 java.lang.String getNumberAsString()
          get number part of value as string number value converted to String without unit
 NumberValue getNumberValue()
          retrieves the value from either the refrenced constant or from the NumberValue
 ParsedPropertyReference getParsedPropertyReference()
          returns parsed property reference object
 ParsedPropertyReference getParsedUnitLiteralReference()
          returns parsed unit literal reference object
 double getScaledValue()
          Get the scaled value of the number, this is the number's value multiplied by the number's unit's absolute factor.
 double getScaledValue(UnitLiteral target)
          Get the scaled value of the number, this is the number's value multiplied by the number's unit's scaling factor for the specified unit.
 UnitLiteral getUnitLiteral()
           
 java.lang.String getUnitLiteralName()
          returns unit literal name from either the unit literal object or the parsed name.
 java.lang.String getValueAsString()
          value as string
 java.lang.String getValueString()
           
 java.lang.Number getXValue()
          get value as Number
 void preEvaluate(PropertyHolder context, java.util.Set reqModeContexts)
          Pre-evaluate a property value to determine which ComponentImpls have modes that can affect the property value.
 void setNewValue(java.lang.Number val)
          Set the value of the number.
 void setParsedPropertyReference(ParsedPropertyReference pr)
          sets parsed names for property reference
 void setParsedUnitLiteral(java.lang.String pr, java.lang.String file, int line)
          sets parsed name of unitliteral
 void setParsedUnitLiteralReference(ParsedPropertyReference pr)
          sets parsed names for unit literal reference
 void setUnitLiteral(UnitLiteral newUnitLiteral)
          phf: we want an add version for EList
 void setValueString(java.lang.String newValueString)
          phf: we want an add version for EList
 java.lang.String toString()
           
 
Methods inherited from class edu.cmu.sei.aadl.model.property.impl.PropertyValueImpl
instantiate
 
Methods inherited from class edu.cmu.sei.aadl.model.core.impl.AObjectImpl
addComment, eObjectForURIFragmentSegment, eURIFragmentSegment, getAadlSpec, getAdapter, getAObjectRoot, getChildren, getComment, getContainingClassifier, getContainingClassifierNameSpace, getContainingComponentImpl, getContainingComponentType, getContainingPropertyAssociationDefinitionConstant, getContainingSubcomponent, getLocationReference, getReferencedObject, getSecondReferencedObject, getSystemInstance, setLocationReference, setLocationReference
 
Methods inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
eAdapters, eBasicAdapters, eBasicProperties, eBasicSetContainer, eClass, eContainerFeatureID, eDeliver, eInternalContainer, eIsProxy, eProperties, eSetClass, eSetDeliver, eSetProxyURI
 
Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
eAddVirtualValue, eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicRemoveFromContainerFeature, eBasicSetContainer, eComputeVirtualValuesCapacity, eContainer, eContainingFeature, eContainmentFeature, eContainmentFeature, eContains, eContents, eCrossReferences, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDirectResource, eDynamicBasicRemoveFromContainer, eDynamicClass, eDynamicFeature, eDynamicFeatureID, eDynamicGet, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicInverseRemove, eDynamicIsSet, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eHasSettings, eInternalResource, eInverseAdd, eInverseAdd, eInverseRemove, eInverseRemove, eIsSet, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eProxyURI, eRemoveVirtualValue, eResolveProxy, eResource, eSet, eSetDirectResource, eSetResource, eSetStore, eSetting, eSettingDelegate, eSettings, eSetVirtualIndexBits, eSetVirtualValue, eSetVirtualValues, eStaticFeatureCount, eStore, eUnset, eVirtualBitCount, eVirtualGet, eVirtualGet, eVirtualIndex, eVirtualIndexBits, eVirtualIsSet, eVirtualSet, eVirtualUnset, eVirtualValue, eVirtualValues
 
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
eNotificationRequired, eNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.cmu.sei.aadl.model.property.PropertyValue
instantiate
 
Methods inherited from interface edu.cmu.sei.aadl.model.core.AObject
addComment, getAadlSpec, getAObjectRoot, getChildren, getComment, getContainingClassifier, getContainingClassifierNameSpace, getContainingComponentImpl, getContainingComponentType, getContainingPropertyAssociationDefinitionConstant, getContainingSubcomponent, getLocationReference, getReferencedObject, getSecondReferencedObject, getSystemInstance, setLocationReference, setLocationReference
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.emf.ecore.InternalEObject
eNotificationRequired
 

Field Detail

PLUS

protected static final char PLUS
See Also:
Constant Field Values

MINUS

protected static final char MINUS
See Also:
Constant Field Values

copyright

public static final java.lang.String copyright

See Also:
Constant Field Values

parsedPropertyReference

protected ParsedPropertyReference parsedPropertyReference
the parsed property reference namesfor the constant reference


parsedUnitLiteralReference

protected ParsedPropertyReference parsedUnitLiteralReference
the parsed property reference names for the unit literal


unitLiteral

protected UnitLiteral unitLiteral
The cached value of the 'Unit Literal' reference.

See Also:
getUnitLiteral()

VALUE_STRING_EDEFAULT

protected static final java.lang.String VALUE_STRING_EDEFAULT
The default value of the 'Value String' attribute.

See Also:
getValueString()

valueString

protected java.lang.String valueString
The cached value of the 'Value String' attribute.

See Also:
getValueString()
Constructor Detail

NumberValueImpl

protected NumberValueImpl()

Method Detail

eStaticClass

protected org.eclipse.emf.ecore.EClass eStaticClass()

Overrides:
eStaticClass in class PropertyValueImpl

getUnitLiteral

public UnitLiteral getUnitLiteral()

Specified by:
getUnitLiteral in interface NumberValue
Returns:
the value of the 'Unit Literal' reference.
See Also:
NumberValue.setUnitLiteral(UnitLiteral), PropertyPackage.getNumberValue_UnitLiteral()

basicGetUnitLiteral

public UnitLiteral basicGetUnitLiteral()


setUnitLiteral

public void setUnitLiteral(UnitLiteral newUnitLiteral)
phf: we want an add version for EList

Specified by:
setUnitLiteral in interface NumberValue
Parameters:
newUnitLiteral - the new value of the 'Unit Literal' reference.
See Also:
NumberValue.getUnitLiteral()

getValueString

public java.lang.String getValueString()

Specified by:
getValueString in interface NumberValue
Returns:
the value of the 'Value String' attribute.
See Also:
NumberValue.setValueString(String), PropertyPackage.getNumberValue_ValueString()

setValueString

public void setValueString(java.lang.String newValueString)
phf: we want an add version for EList

Specified by:
setValueString in interface NumberValue
Parameters:
newValueString - the new value of the 'Value String' attribute.
See Also:
NumberValue.getValueString()

eGet

public java.lang.Object eGet(int featureID,
                             boolean resolve,
                             boolean coreType)

Specified by:
eGet in interface org.eclipse.emf.ecore.InternalEObject
Overrides:
eGet in class AObjectImpl

eSet

public void eSet(int featureID,
                 java.lang.Object newValue)

Specified by:
eSet in interface org.eclipse.emf.ecore.InternalEObject
Overrides:
eSet in class AObjectImpl

eUnset

public void eUnset(int featureID)

Specified by:
eUnset in interface org.eclipse.emf.ecore.InternalEObject
Overrides:
eUnset in class AObjectImpl

eIsSet

public boolean eIsSet(int featureID)

Specified by:
eIsSet in interface org.eclipse.emf.ecore.InternalEObject
Overrides:
eIsSet in class AObjectImpl

toString

public java.lang.String toString()

Overrides:
toString in class AObjectImpl

setParsedPropertyReference

public void setParsedPropertyReference(ParsedPropertyReference pr)
sets parsed names for property reference

Specified by:
setParsedPropertyReference in interface NumberValue
Parameters:
pr - parsed property reference object

getParsedPropertyReference

public ParsedPropertyReference getParsedPropertyReference()
returns parsed property reference object

Specified by:
getParsedPropertyReference in interface NumberValue
Returns:
ParsedPropertyReference of unit literal

setParsedUnitLiteralReference

public void setParsedUnitLiteralReference(ParsedPropertyReference pr)
sets parsed names for unit literal reference

Specified by:
setParsedUnitLiteralReference in interface NumberValue
Parameters:
pr - parsed property reference object

setParsedUnitLiteral

public void setParsedUnitLiteral(java.lang.String pr,
                                 java.lang.String file,
                                 int line)
sets parsed name of unitliteral

Specified by:
setParsedUnitLiteral in interface NumberValue
Parameters:
pr - parsed of unitliteral as string
file - file name as string
line - line number as string

getParsedUnitLiteralReference

public ParsedPropertyReference getParsedUnitLiteralReference()
returns parsed unit literal reference object

Specified by:
getParsedUnitLiteralReference in interface NumberValue
Returns:
ParsedPropertyReference

getUnitLiteralName

public java.lang.String getUnitLiteralName()
returns unit literal name from either the unit literal object or the parsed name. reutnrs empty string if neither is found.

Specified by:
getUnitLiteralName in interface NumberValue

evaluate

public final AadlPropertyValue evaluate(PropertyHolder context,
                                        java.util.Map modes)
Description copied from interface: PropertyValue
Evaluate a property value.

Specified by:
evaluate in interface PropertyValue
Overrides:
evaluate in class PropertyValueImpl
Parameters:
context - The context in which to look up any property value references.
modes - The mode in which to look up the value; a mapping from component impls to modes
Returns:
The evaluated property value.

preEvaluate

public final void preEvaluate(PropertyHolder context,
                              java.util.Set reqModeContexts)
Description copied from interface: PropertyValue
Pre-evaluate a property value to determine which ComponentImpls have modes that can affect the property value.

Specified by:
preEvaluate in interface PropertyValue
Overrides:
preEvaluate in class PropertyValueImpl
Parameters:
context - The context in which the property value is to be looked up.
reqModeContexts - The working set of component implementations whose modes affect the value of the property. This set is modified as a side-effect of this method.

getXValue

public java.lang.Number getXValue()
get value as Number

Specified by:
getXValue in interface NumberValue
Returns:
The value of the number literal.

getScaledValue

public final double getScaledValue()
Get the scaled value of the number, this is the number's value multiplied by the number's unit's absolute factor. If the number doesn't have a unit then the scaled value is the same as the number's value.

Specified by:
getScaledValue in interface NumberValue

getScaledValue

public final double getScaledValue(UnitLiteral target)
Get the scaled value of the number, this is the number's value multiplied by the number's unit's scaling factor for the specified unit. If the number doesn't have a unit then the scaled value is the same as the number's value.

Specified by:
getScaledValue in interface NumberValue
Parameters:
target - UnitLiteral

setNewValue

public void setNewValue(java.lang.Number val)
Description copied from interface: NumberValue
Set the value of the number.

Specified by:
setNewValue in interface NumberValue
Parameters:
val - The value.

getValueAsString

public java.lang.String getValueAsString()
value as string

Specified by:
getValueAsString in interface PropertyValue
Returns:
integer and optional units

getNumberAsString

public java.lang.String getNumberAsString()
get number part of value as string number value converted to String without unit

Specified by:
getNumberAsString in interface NumberValue
Returns:
String

getNumberValue

public NumberValue getNumberValue()
retrieves the value from either the refrenced constant or from the NumberValue

Specified by:
getNumberValue in interface NumberOrPropertyReference
Returns:
NumberValue

cloneNumber

public NumberValue cloneNumber()
Description copied from interface: NumberValue
Clone this number value.

Specified by:
cloneNumber in interface NumberValue

cloneAndInvert

public NumberValue cloneAndInvert()
Description copied from interface: NumberValue
Create a "clone" that inverts this value. It is a cloen in the sense that it represent a number from the same source location.

Specified by:
cloneAndInvert in interface NumberValue