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 boolean delete() {
    boolean result = super.delete();
    boolean delete_error = false;
    String errorMsg =
        "The following relationships were not torn down by the Instance State Machine.dispose call: ";
    ModelClass_c testR518Inst = ModelClass_c.getOneO_OBJOnR518(this, false);

    if (testR518Inst != null) {
      delete_error = true;
      errorMsg = errorMsg + "518 ";
    }
    StateMachine_c testR517Inst1 = StateMachine_c.getOneSM_SMOnR517(this, false);

    if (testR517Inst1 != null) {
      delete_error = true;
      errorMsg = errorMsg + "517 ";
    }
    if (delete_error == true) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(ILogger.DELETE, "Instance State Machine", errorMsg);
      } else {
        Exception e = new Exception();
        e.fillInStackTrace();
        CorePlugin.logError(errorMsg, e);
      }
    }
    return result;
  }
  public static InstanceStateMachine_c getOneSM_ISMOnR518(
      ModelRoot modelRoot, ModelClass_c target, ClassQueryInterface_c test, boolean loadComponent) {
    InstanceStateMachine_c result = null;

    result = find_getOneSM_ISMOnR518(modelRoot, target, test);
    if (result == null && (loadComponent)) {
      // Containment Relation
      List comps =
          PersistenceManager.findAllChildComponents(
              target.getPersistableComponent(), modelRoot, InstanceStateMachine_c.class);
      for (int i = 0; i < comps.size(); i++) {
        PersistableModelComponent component = (PersistableModelComponent) comps.get(i);
        if (!component.isLoaded()) {
          try {
            component.load(new NullProgressMonitor());
            result = find_getOneSM_ISMOnR518(modelRoot, target, test);
            if (result != null) return result;
          } catch (Exception e) {
            CorePlugin.logError("Error Loading component", e);
          }
        }
      }
    }

    return result;
  }
 public static InstanceStateMachine_c getOneSM_ISMOnR518(
     ModelClass_c target, ClassQueryInterface_c test) {
   if (target != null) {
     return getOneSM_ISMOnR518(target.getModelRoot(), target, test);
   }
   return null;
 }
  // declare transform functions
  public String Get_name() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Instance State Machine",
        " Operation entered: InstanceStateMachine::Get_name");
    final ModelRoot modelRoot = getModelRoot();
    ModelClass_c v_obj = ModelClass_c.getOneO_OBJOnR518(this);

    if (((v_obj != null))) {

      return v_obj.getName();

    } else {

      return Ooaofooa.Getorphanedelementname(modelRoot);
    }
  } // End get_name
  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);
      }
    }
  }
  public boolean checkConsistency() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Instance State Machine", //$NON-NLS-1$
        " Operation entered: Instance State Machine::checkConsistency"); //$NON-NLS-1$
    if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$
      return true;
    }
    ModelRoot modelRoot = getModelRoot();
    boolean retval = true;
    class InstanceStateMachine_c_test39208_c implements ClassQueryInterface_c {
      InstanceStateMachine_c_test39208_c(java.util.UUID p39209) {
        m_p39209 = p39209;
      }

      private java.util.UUID m_p39209;

      public boolean evaluate(Object candidate) {
        InstanceStateMachine_c selected = (InstanceStateMachine_c) candidate;
        boolean retval = false;
        retval = (selected.getSm_id().equals(m_p39209));
        return retval;
      }
    }

    InstanceStateMachine_c[] objs39207 =
        InstanceStateMachine_c.InstanceStateMachineInstances(
            modelRoot, new InstanceStateMachine_c_test39208_c(getSm_id()));

    if (((objs39207.length) == 0)) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Instance State Machine", //$NON-NLS-1$
            "Consistency: Object: Instance State Machine: Cardinality of an identifier is zero. " //$NON-NLS-1$
                + "Actual Value: "
                + Integer.toString(objs39207.length)); // $NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Instance State Machine: Cardinality of an identifier is zero. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs39207.length),
            e);
      }
      retval = false;
    }

    if (((objs39207.length) > 1)) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Instance State Machine", //$NON-NLS-1$
            "Consistency: Object: Instance State Machine: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs39207.length)
                + " SM_ID: "
                + "Not Printable"); //$NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Instance State Machine: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs39207.length)
                + " SM_ID: "
                + "Not Printable",
            e); //$NON-NLS-1$
      }
      retval = false;
    }

    // Instance State Machine is a subtype in association: rel.Numb = 517
    // The supertype class is: State Machine
    class StateMachine_c_test39213_c implements ClassQueryInterface_c {
      StateMachine_c_test39213_c(java.util.UUID p39214) {
        m_p39214 = p39214;
      }

      private java.util.UUID m_p39214;

      public boolean evaluate(Object candidate) {
        StateMachine_c selected = (StateMachine_c) candidate;
        boolean retval = false;
        retval = (selected.getSm_id().equals(m_p39214));
        return retval;
      }
    }

    StateMachine_c[] objs39212 =
        StateMachine_c.StateMachineInstances(modelRoot, new StateMachine_c_test39213_c(getSm_id()));

    if (((objs39212.length) != 1)) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Instance State Machine", //$NON-NLS-1$
            "Consistency: Object: Instance State Machine: Association: 517: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: "
                + Integer.toString(objs39212.length)); // $NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Instance State Machine: Association: 517: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs39212.length),
            e);
      }
      retval = false;
    }

    // Instance State Machine is a referring class in association: rel.Numb = 518
    // The participating class is: Model Class
    class ModelClass_c_test39216_c implements ClassQueryInterface_c {
      ModelClass_c_test39216_c(java.util.UUID p39217) {
        m_p39217 = p39217;
      }

      private java.util.UUID m_p39217;

      public boolean evaluate(Object candidate) {
        ModelClass_c selected = (ModelClass_c) candidate;
        boolean retval = false;
        retval = (selected.getObj_id().equals(m_p39217));
        return retval;
      }
    }

    ModelClass_c[] objs39215 =
        ModelClass_c.ModelClassInstances(modelRoot, new ModelClass_c_test39216_c(getObj_id()));

    // The participant is unconditional
    // The multiplicity of the participant is one
    if (((objs39215.length) != 1)) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Instance State Machine", //$NON-NLS-1$
            "Consistency: Object: Instance State Machine: Association: 518: Cardinality of a participant is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs39215.length)
                + " Obj_ID: "
                + "Not Printable"); //$NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Instance State Machine: Association: 518: Cardinality of a participant is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs39215.length)
                + " Obj_ID: "
                + "Not Printable",
            e); //$NON-NLS-1$
      }
      retval = false;
    }

    return retval;
  }
 public java.util.UUID getObj_id() {
   if (ModelClass != null) {
     return ModelClass.getObj_id();
   }
   return IdAssigner.NULL_UUID;
 }
 public long getObj_idLongBased() {
   if (ModelClass != null) {
     return ModelClass.getObj_idLongBased();
   }
   return 0;
 }
  public void batchRelate(
      ModelRoot modelRoot, boolean relateProxies, boolean notifyChanges, boolean searchAllRoots) {
    InstanceList instances = null;
    ModelRoot baseRoot = modelRoot;

    if (ModelClass == null) {
      // R518
      ModelClass_c relInst39205 =
          (ModelClass_c) baseRoot.getInstanceList(ModelClass_c.class).get(new Object[] {m_obj_id});
      // if there was no local element, check for any global elements
      // failing that proceed to check other model roots
      if (relInst39205 == null) {
        relInst39205 =
            (ModelClass_c)
                Ooaofooa.getDefaultInstance()
                    .getInstanceList(ModelClass_c.class)
                    .get(new Object[] {m_obj_id});
      }
      if (relInst39205 == null && searchAllRoots && !baseRoot.isCompareRoot()) {
        Ooaofooa[] roots = Ooaofooa.getInstances();
        for (int i = 0; i < roots.length; i++) {
          if (roots[i].isCompareRoot()) {
            // never use elements from any compare root
            continue;
          }
          relInst39205 =
              (ModelClass_c)
                  roots[i].getInstanceList(ModelClass_c.class).get(new Object[] {m_obj_id});
          if (relInst39205 != null) break;
        }
      }
      // synchronized
      if (relInst39205 != null) {
        if (relateProxies || !isProxy() || (inSameComponent(this, relInst39205) && !isProxy())) {
          relInst39205.relateAcrossR518To(this, notifyChanges);
        }
      }
    }

    // R517
    StateMachine_c relInst39206 =
        (StateMachine_c) baseRoot.getInstanceList(StateMachine_c.class).get(new Object[] {m_sm_id});
    // if there was no local element, check for any global elements
    // failing that proceed to check other model roots
    if (relInst39206 == null) {
      relInst39206 =
          (StateMachine_c)
              Ooaofooa.getDefaultInstance()
                  .getInstanceList(StateMachine_c.class)
                  .get(new Object[] {m_sm_id});
    }
    if (relInst39206 == null && searchAllRoots && !baseRoot.isCompareRoot()) {
      Ooaofooa[] roots = Ooaofooa.getInstances();
      for (int i = 0; i < roots.length; i++) {
        if (roots[i].isCompareRoot()) {
          // never use elements from any compare root
          continue;
        }
        relInst39206 =
            (StateMachine_c)
                roots[i].getInstanceList(StateMachine_c.class).get(new Object[] {m_sm_id});
        if (relInst39206 != null) break;
      }
    }
    // synchronized
    if (relInst39206 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst39206) && !isProxy())) {
        relInst39206.relateAcrossR517To(this, notifyChanges);
      }
    }
  }
 public static InstanceStateMachine_c getOneSM_ISMOnR518(
     ModelClass_c target, boolean loadComponent) {
   return getOneSM_ISMOnR518(target.getModelRoot(), target, null, loadComponent);
 }
 public boolean evaluate(Object candidate) {
   ModelClass_c selected = (ModelClass_c) candidate;
   boolean retval = false;
   retval = (selected.getObj_id().equals(m_p39217));
   return retval;
 }