public void unrelateAcrossR39From(DataType_c target, boolean notifyChanges) {
    if (target == null) return;

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

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

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

    if (ContainsDataType != null) {

      m_dt_id = ContainsDataType.getDt_id();
      if (IdAssigner.NULL_UUID.equals(m_dt_id)) {
        m_dt_id = ContainsDataType.getDt_idCachedValue();
      }
      ContainsDataType = null;
      target.removeRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "39", "");
        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 Data Type in Package.dispose call: ";
    DataType_c testR39Inst = DataType_c.getOneS_DTOnR39(this, false);

    if (testR39Inst != null) {
      delete_error = true;
      errorMsg = errorMsg + "39 ";
    }

    DataTypePackage_c testR39InstOth = DataTypePackage_c.getOneS_DPKOnR39(this, false);

    if (testR39InstOth != null) {
      delete_error = true;
      errorMsg = errorMsg + "39 ";
    }
    if (delete_error == true) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(ILogger.DELETE, "Data Type in Package", errorMsg);
      } else {
        Exception e = new Exception();
        e.fillInStackTrace();
        CorePlugin.logError(errorMsg, e);
      }
    }
    return result;
  }
 public static DataTypeInPackage_c getOneS_DIPOnR39(
     DataType_c target, ClassQueryInterface_c test) {
   if (target != null) {
     return getOneS_DIPOnR39(target.getModelRoot(), target, test);
   }
   return null;
 }
  public void relateAcrossR39To(DataType_c target, boolean notifyChanges) {
    if (target == null) return;

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

    if (ContainsDataType != target) {

      Object oldKey = getInstanceKey();

      if (ContainsDataType != null) {

        ContainsDataType.clearBackPointerR39To(this);

        if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$
          Ooaofooa.log.println(
              ILogger.CONSISTENCY,
              "DataTypeInPackage_c.relateAcrossR39To(DataType_c target)",
              "Relate performed across R39 from Data Type in Package to Data Type without unrelate of prior instance.");
        }
      }

      ContainsDataType = target;
      if (IdAssigner.NULL_UUID.equals(target.getDt_id())) {
        // do not update cached value
      } else {
        // update cached value
        m_dt_id = target.getDt_idCachedValue();
      }
      updateInstanceKey(oldKey, getInstanceKey());
      target.setBackPointerR39To(this);
      target.addRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "39", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
 public java.util.UUID getDt_id() {
   if (ContainsDataType != null) {
     return ContainsDataType.getDt_id();
   }
   return IdAssigner.NULL_UUID;
 }
 public long getDt_idLongBased() {
   if (ContainsDataType != null) {
     return ContainsDataType.getDt_idLongBased();
   }
   return 0;
 }
  public void batchRelate(
      ModelRoot modelRoot, boolean relateProxies, boolean notifyChanges, boolean searchAllRoots) {
    InstanceList instances = null;
    ModelRoot baseRoot = modelRoot;

    // R39
    DataTypePackage_c relInst55157 =
        (DataTypePackage_c)
            baseRoot.getInstanceList(DataTypePackage_c.class).get(new Object[] {m_package_id});
    // if there was no local element, check for any global elements
    // failing that proceed to check other model roots
    if (relInst55157 == null) {
      relInst55157 =
          (DataTypePackage_c)
              Ooaofooa.getDefaultInstance()
                  .getInstanceList(DataTypePackage_c.class)
                  .get(new Object[] {m_package_id});
    }
    if (relInst55157 == 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;
        }
        relInst55157 =
            (DataTypePackage_c)
                roots[i].getInstanceList(DataTypePackage_c.class).get(new Object[] {m_package_id});
        if (relInst55157 != null) break;
      }
    }
    // synchronized
    if (relInst55157 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst55157) && !isProxy())) {
        relInst55157.relateAcrossR39To(this, notifyChanges);
      }
    }

    DataType_c relInst55158 =
        (DataType_c) baseRoot.getInstanceList(DataType_c.class).get(new Object[] {m_dt_id});
    // if there was no local element, check for any global elements
    // failing that proceed to check other model roots
    if (relInst55158 == null) {
      relInst55158 =
          (DataType_c)
              Ooaofooa.getDefaultInstance()
                  .getInstanceList(DataType_c.class)
                  .get(new Object[] {m_dt_id});
    }
    if (relInst55158 == 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;
        }
        relInst55158 =
            (DataType_c) roots[i].getInstanceList(DataType_c.class).get(new Object[] {m_dt_id});
        if (relInst55158 != null) break;
      }
    }
    // synchronized
    if (relInst55158 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst55158) && !isProxy())) {
        relInst55158.relateAcrossR39To(this, notifyChanges);
      }
    }
  }
 public static DataTypeInPackage_c getOneS_DIPOnR39(DataType_c target, boolean loadComponent) {
   return getOneS_DIPOnR39(target.getModelRoot(), target, null, loadComponent);
 }