edu.ksu.cis.cadena.core.adapter
Class BaseCadenaAdapter

java.lang.Object
  extended by edu.ksu.cis.cadena.core.adapter.BaseCadenaAdapter
All Implemented Interfaces:
CadenaAdapter
Direct Known Subclasses:
AbstractBaseKindAdapter, AbstractInstanceAdapter, AbstractTypeAdapter, BooleanValueAdapter, CollectionTypeAdapter, CollectionValueAdapter, ConnectorDeclarationAdapter, DirectPropertyContainerAdapter, EnumMemberAdapter, EnumTypeAdapter, EnumValueAdapter, InstanceRoleAdapter, IntegerValueAdapter, InterfaceKindBindingAdapter, InterfaceTypeVariableAdapter, ModuleAdapter, OpenPropertyBindingAdapter, PortAdapter, PortBindingAdapter, PortPropertyContainerAdapter, PortSpecAdapter, PropertyAdapter, PropertyDeclarationAdapter, ScenarioAdapter, ScenarioPortAdapter, StringValueAdapter, StructTypeAdapter, StructTypeMemberAdapter, StructValueAdapter, StructValueMemberImplAdapter, StyleAdapter

public abstract class BaseCadenaAdapter
extends java.lang.Object
implements CadenaAdapter

Implementation base for Cadena adapters. Provides methods for iterating across all CadenaAdapter's adapting a particular model node, and collecting referrers who would be affected by a structural change.

Author:
Matt Hoosier

Field Summary
static java.lang.String REFERENCED_OBJECT_IN_TRASH_ERROR
           
 
Constructor Summary
BaseCadenaAdapter()
           
 
Method Summary
 void addAffectedReferrers(Notification notification, EObject notifyingObject, EStructuralFeature notifyingObjectFeature, java.util.Set<Triple<CadenaAdapter,EObject,EStructuralFeature>> referrers)
           Calculate the set of model objects whose well-formedness could be affected by a structural change to element.
 void addNotificationValues(Notification notification, java.util.Set<Pair<EObject,EStructuralFeature>> returnVal)
          Adds a notification's old and new values (if they are instances of EObject) to an affected set.
 void checkNode(EObject node)
          Called when a complete check of the model is performed.
abstract  void forwardReferenceChanged(Notification notification, EObject notifyingObject, EStructuralFeature notifyingObjectFeature)
           
 java.util.Set<? extends EObject> getAffectedValues(Notification notification)
           
 Notifier getTarget()
           
 boolean isAdapterForType(java.lang.Object type)
           
 void notifyChanged(Notification notification)
           
static void setMarkers(java.lang.Object markedObject, java.lang.String markerType, java.lang.String... messages)
           
 void setTarget(Notifier newTarget)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFERENCED_OBJECT_IN_TRASH_ERROR

public static final java.lang.String REFERENCED_OBJECT_IN_TRASH_ERROR
Constructor Detail

BaseCadenaAdapter

public BaseCadenaAdapter()
Method Detail

addAffectedReferrers

public final void addAffectedReferrers(Notification notification,
                                       EObject notifyingObject,
                                       EStructuralFeature notifyingObjectFeature,
                                       java.util.Set<Triple<CadenaAdapter,EObject,EStructuralFeature>> referrers)
Description copied from interface: CadenaAdapter

Calculate the set of model objects whose well-formedness could be affected by a structural change to element.

In order to prevent infinite, circular call sequences, the protocol for adding a referrer should be as follows:

      Triple<CadenaAdapter, EObject, Integer> client = ...;
        
      if (!referrers.contains(client))
      {
          referrers.add(client);
         
          List<Adapter> adapters = client.second.eAdapters();
              
          for (Adapter a : adapters)
          {
              if (a instanceof CadenaAdapter)
              {
                  ((CadenaAdapter)a).addAffectedReferrers(
                      client.second,
                      a,
                      client.third);
              }
          }
      }
 

Specified by:
addAffectedReferrers in interface CadenaAdapter

checkNode

public void checkNode(EObject node)
Description copied from interface: CadenaAdapter
Called when a complete check of the model is performed. All checks that the adapter provides should be checked by this call.

Specified by:
checkNode in interface CadenaAdapter
Parameters:
node - The current node being checked.

notifyChanged

public void notifyChanged(Notification notification)

forwardReferenceChanged

public abstract void forwardReferenceChanged(Notification notification,
                                             EObject notifyingObject,
                                             EStructuralFeature notifyingObjectFeature)
Specified by:
forwardReferenceChanged in interface CadenaAdapter

setTarget

public void setTarget(Notifier newTarget)

getTarget

public Notifier getTarget()

isAdapterForType

public boolean isAdapterForType(java.lang.Object type)

getAffectedValues

public java.util.Set<? extends EObject> getAffectedValues(Notification notification)

addNotificationValues

public void addNotificationValues(Notification notification,
                                  java.util.Set<Pair<EObject,EStructuralFeature>> returnVal)
Adds a notification's old and new values (if they are instances of EObject) to an affected set.


setMarkers

public static void setMarkers(java.lang.Object markedObject,
                              java.lang.String markerType,
                              java.lang.String... messages)