public void unrelateAcrossR517From(StateMachine_c target, boolean notifyChanges) { if (target == null) return; if (IsSupertypeStateMachine == null) return; // already unrelated if (target != IsSupertypeStateMachine) { Exception e = new Exception(); e.fillInStackTrace(); CorePlugin.logError("Tried to unrelate from non-related instance across R517", e); return; } if (target != null) { target.clearBackPointerR517To(this); } if (IsSupertypeStateMachine != null) { m_sm_id = IsSupertypeStateMachine.getSm_id(); IsSupertypeStateMachine = null; target.removeRef(); if (notifyChanges) { RelationshipChangeModelDelta change = new RelationshipChangeModelDelta( Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "517", ""); Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change); } } }
public void relateAcrossR517To(StateMachine_c target, boolean notifyChanges) { if (target == null) return; if (target == IsSupertypeStateMachine) return; // already related if (IsSupertypeStateMachine != target) { Object oldKey = getInstanceKey(); if (IsSupertypeStateMachine != null) { IsSupertypeStateMachine.clearBackPointerR517To(this); if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$ Ooaofooa.log.println( ILogger.CONSISTENCY, "InstanceStateMachine_c.relateAcrossR517To(StateMachine_c target)", "Relate performed across R517 from Instance State Machine to State Machine without unrelate of prior instance."); } } IsSupertypeStateMachine = target; m_sm_id = target.getSm_id(); updateInstanceKey(oldKey, getInstanceKey()); target.setBackPointerR517To(this); target.addRef(); if (notifyChanges) { RelationshipChangeModelDelta change = new RelationshipChangeModelDelta( Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "517", ""); Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change); } } }