edu.cmu.sei.aadl.aadl2.properties
Class InstanceUtil

java.lang.Object
  extended by edu.cmu.sei.aadl.aadl2.properties.InstanceUtil

public class InstanceUtil
extends java.lang.Object

Author:
lwrage

Nested Class Summary
static class InstanceUtil.InstantiatedClassifier
           
 
Constructor Summary
InstanceUtil()
           
 
Method Summary
static ComponentClassifier getComponentClassifier(ComponentInstance ci, int index, java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
          Get the component classifier of a component instance.
static ComponentImplementation getComponentImplementation(ComponentInstance ci, int index, java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
          Get the component implementation of a component instance.
static ComponentType getComponentType(ComponentInstance ci, int index, java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
          Get the component type of a component instance.
static InstanceUtil.InstantiatedClassifier getInstantiatedClassifier(InstanceObject iobj, int index)
          Get the component or feature group classifier that is instantiated by an instance object.
static InstanceUtil.InstantiatedClassifier getInstantiatedClassifier(InstanceObject iobj, int index, java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
          Get the component or feature group classifier that is instantiated by an instance object.
static ComponentReference resolveComponentPrototype(Prototype proto, InstanceObject context, java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
          Find the binding for a given component prototype.
static FeatureGroupReference resolveFeatureGroupPrototype(Prototype proto, InstanceObject context, java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
          Find the binding for a given feature group prototype.
static FeaturePrototypeActual resolveFeaturePrototype(Prototype proto, InstanceObject context, java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
          Find the binding for a given feature prototype.
static PrototypeBinding resolvePrototype(Prototype proto, InstanceObject context, java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
          Find the binding for a given prototype.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceUtil

public InstanceUtil()
Method Detail

getComponentType

public static ComponentType getComponentType(ComponentInstance ci,
                                             int index,
                                             java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
Get the component type of a component instance. Resolve prototypes if needed.

Parameters:
ci - the component instance
index - the index of the instance object in an array
classifierCache - an optional cache of known instantiated classifiers, may be null
Returns:
the component type

getComponentImplementation

public static ComponentImplementation getComponentImplementation(ComponentInstance ci,
                                                                 int index,
                                                                 java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
Get the component implementation of a component instance. Resolve prototypes if needed.

Parameters:
ci - the component instance
index - the index of the instance object in an array
classifierCache - an optional cache of known instantiated classifiers, may be null
Returns:
the component implementation

getComponentClassifier

public static ComponentClassifier getComponentClassifier(ComponentInstance ci,
                                                         int index,
                                                         java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
Get the component classifier of a component instance. Resolve prototypes if needed.

Parameters:
ci - the component instance
index - the index of the instance object in an array
classifierCache - an optional cache of known instantiated classifiers, may be null
Returns:
the component classifier

getInstantiatedClassifier

public static InstanceUtil.InstantiatedClassifier getInstantiatedClassifier(InstanceObject iobj,
                                                                            int index)
Get the component or feature group classifier that is instantiated by an instance object. Resolve prototypes if needed.

Parameters:
iobj - the instance object
index - the index of the instance object in an array
Returns:
the instantiated classifier together with bindings for anonymous classifiers

getInstantiatedClassifier

public static InstanceUtil.InstantiatedClassifier getInstantiatedClassifier(InstanceObject iobj,
                                                                            int index,
                                                                            java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
Get the component or feature group classifier that is instantiated by an instance object. Resolve prototypes if needed.

Parameters:
iobj - the instance object
index - the index of the instance object in an array
classifierCache - an optional cache of known instantiated classifiers, may be null
Returns:
the instantiated classifier together with bindings for anonymous classifiers

resolveComponentPrototype

public static ComponentReference resolveComponentPrototype(Prototype proto,
                                                           InstanceObject context,
                                                           java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
Find the binding for a given component prototype.

Parameters:
proto - the prototype to resolve
context - the context in which the prototype is used, e.g., a subcomponent instance
classifierCache - an optional cache of known instantiated classifiers, may be null
Returns:
The component reference that the prototype resolves to.

resolveFeatureGroupPrototype

public static FeatureGroupReference resolveFeatureGroupPrototype(Prototype proto,
                                                                 InstanceObject context,
                                                                 java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
Find the binding for a given feature group prototype.

Parameters:
proto - the prototype to resolve
context - the context in which the prototype is used, e.g., a subcomponent instance
classifierCache - an optional cache of known instantiated classifiers, may be null
Returns:
The feature group reference the prototype is bound to.

resolveFeaturePrototype

public static FeaturePrototypeActual resolveFeaturePrototype(Prototype proto,
                                                             InstanceObject context,
                                                             java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
Find the binding for a given feature prototype.

Parameters:
proto - the prototype to resolve
context - the context in which the prototype is used, e.g., a subcomponent instance
classifierCache - an optional cache of known instantiated classifiers, may be null
Returns:
The actual feature this prototype resolves to.

resolvePrototype

public static PrototypeBinding resolvePrototype(Prototype proto,
                                                InstanceObject context,
                                                java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
Find the binding for a given prototype.

Parameters:
proto - the prototype to resolve
context - the context in which the prototype is used, e.g., a subcomponent instance
classifierCache - an optional cache of known instantiated classifiers, may be null
Returns:
The binding that assigns the value to the prototype relative to its usage context.