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);
      }
    }
  }