public void unrelateAcrossR518From(ModelClass_c target, boolean notifyChanges) {
    if (target == null) return;

    if (ModelClass == null) return; // already unrelated

    if (target != ModelClass) {
      Exception e = new Exception();
      e.fillInStackTrace();
      CorePlugin.logError("Tried to unrelate from non-related instance across R518", e);
      return;
    }

    if (target != null) {
      target.clearBackPointerR518To(this);
    }

    if (ModelClass != null) {

      m_obj_id = ModelClass.getObj_id();
      if (IdAssigner.NULL_UUID.equals(m_obj_id)) {
        m_obj_id = ModelClass.getObj_idCachedValue();
      }
      ModelClass = null;
      target.removeRef();
      UmlProblem.removeXtUMLProblem(this, target);
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "518", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
  public void relateAcrossR518To(ModelClass_c target, boolean notifyChanges) {
    if (target == null) return;

    if (target == ModelClass) return; // already related

    if (ModelClass != target) {

      Object oldKey = getInstanceKey();

      if (ModelClass != null) {
        UmlProblem.removeXtUMLProblem(this, ModelClass);

        ModelClass.clearBackPointerR518To(this);

        if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$
          Ooaofooa.log.println(
              ILogger.CONSISTENCY,
              "InstanceStateMachine_c.relateAcrossR518To(ModelClass_c target)",
              "Relate performed across R518 from Instance State Machine to Model Class without unrelate of prior instance.");
        }
      }

      ModelClass = target;
      if (IdAssigner.NULL_UUID.equals(target.getObj_id())) {
        // do not update cached value
      } else {
        // update cached value
        m_obj_id = target.getObj_idCachedValue();
      }
      updateInstanceKey(oldKey, getInstanceKey());
      target.setBackPointerR518To(this);
      target.addRef();
      UmlProblem.handleDanglingReference(this, target);
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "518", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }