コード例 #1
0
  public void unrelateAcrossR39From(DataTypePackage_c target, boolean notifyChanges) {
    if (target == null) return;

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

    if (target != IsContainedInDataTypePackage) {
      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 (IsContainedInDataTypePackage != null) {

      m_package_id = IsContainedInDataTypePackage.getPackage_id();
      if (IdAssigner.NULL_UUID.equals(m_package_id)) {
        m_package_id = IsContainedInDataTypePackage.getPackage_idCachedValue();
      }
      IsContainedInDataTypePackage = null;
      target.removeRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "39", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
コード例 #2
0
  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;
  }
コード例 #3
0
  public static DataTypeInPackage_c[] getManyS_DIPsOnR39(
      DataTypePackage_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new DataTypeInPackage_c[0];

    ModelRoot modelRoot = target.getModelRoot();
    Vector matches = new Vector();
    synchronized (target.backPointer_ContainsDataTypeInPackageContains_R39) {
      for (int i = 0; i < target.backPointer_ContainsDataTypeInPackageContains_R39.size(); ++i) {
        DataTypeInPackage_c source =
            (DataTypeInPackage_c) target.backPointer_ContainsDataTypeInPackageContains_R39.get(i);
        if (source != null && (test == null || test.evaluate(source))) {

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      DataTypeInPackage_c[] ret_set = new DataTypeInPackage_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new DataTypeInPackage_c[0];
    }
  }
コード例 #4
0
 public static DataTypeInPackage_c getOneS_DIPOnR39(
     DataTypePackage_c target, ClassQueryInterface_c test) {
   if (target != null) {
     return getOneS_DIPOnR39(target.getModelRoot(), target, test);
   }
   return null;
 }
コード例 #5
0
  public void relateAcrossR39To(DataTypePackage_c target, boolean notifyChanges) {
    if (target == null) return;

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

    if (IsContainedInDataTypePackage != target) {

      Object oldKey = getInstanceKey();

      if (IsContainedInDataTypePackage != null) {

        IsContainedInDataTypePackage.clearBackPointerR39To(this);

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

      IsContainedInDataTypePackage = target;
      if (IdAssigner.NULL_UUID.equals(target.getPackage_id())) {
        // do not update cached value
      } else {
        // update cached value
        m_package_id = target.getPackage_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);
      }
    }
  }
コード例 #6
0
 public java.util.UUID getPackage_id() {
   if (IsContainedInDataTypePackage != null) {
     return IsContainedInDataTypePackage.getPackage_id();
   }
   return IdAssigner.NULL_UUID;
 }
コード例 #7
0
 // declare attribute accessors
 public long getPackage_idLongBased() {
   if (IsContainedInDataTypePackage != null) {
     return IsContainedInDataTypePackage.getPackage_idLongBased();
   }
   return 0;
 }
コード例 #8
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);
      }
    }
  }
コード例 #9
0
 public static DataTypeInPackage_c getOneS_DIPOnR39(
     DataTypePackage_c target, boolean loadComponent) {
   return getOneS_DIPOnR39(target.getModelRoot(), target, null, loadComponent);
 }
コード例 #10
0
 public boolean evaluate(Object candidate) {
   DataTypePackage_c selected = (DataTypePackage_c) candidate;
   boolean retval = false;
   retval = (selected.getPackage_id().equals(m_p55167));
   return retval;
 }
コード例 #11
0
  public boolean checkConsistency() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Data Type in Package", //$NON-NLS-1$
        " Operation entered: Data Type in Package::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 DataTypeInPackage_c_test55160_c implements ClassQueryInterface_c {
      DataTypeInPackage_c_test55160_c(java.util.UUID p55161, java.util.UUID p55162) {
        m_p55161 = p55161;
        m_p55162 = p55162;
      }

      private java.util.UUID m_p55161;
      private java.util.UUID m_p55162;

      public boolean evaluate(Object candidate) {
        DataTypeInPackage_c selected = (DataTypeInPackage_c) candidate;
        boolean retval = false;
        retval =
            (selected.getPackage_id().equals(m_p55161)) & (selected.getDt_id().equals(m_p55162));
        return retval;
      }
    }

    DataTypeInPackage_c[] objs55159 =
        DataTypeInPackage_c.DataTypeInPackageInstances(
            modelRoot, new DataTypeInPackage_c_test55160_c(getPackage_id(), getDt_id()));

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

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

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

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

    // Data Type in Package is a link class in association: rel.Numb = 39
    // Other side
    // The other side class in the association is: Data Type Package
    class DataTypePackage_c_test55166_c implements ClassQueryInterface_c {
      DataTypePackage_c_test55166_c(java.util.UUID p55167) {
        m_p55167 = p55167;
      }

      private java.util.UUID m_p55167;

      public boolean evaluate(Object candidate) {
        DataTypePackage_c selected = (DataTypePackage_c) candidate;
        boolean retval = false;
        retval = (selected.getPackage_id().equals(m_p55167));
        return retval;
      }
    }

    DataTypePackage_c[] objs55165 =
        DataTypePackage_c.DataTypePackageInstances(
            modelRoot, new DataTypePackage_c_test55166_c(getPackage_id()));

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

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Data Type in Package", //$NON-NLS-1$
            "Consistency: Object: Data Type in Package: Association: 39: Cardinality of other side of link is greater than 1. " //$NON-NLS-1$
                + "Actual Value: "
                + Integer.toString(objs55165.length)); // $NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Data Type in Package: Association: 39: Cardinality of other side of link is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs55165.length),
            e);
      }
      retval = false;
    }

    return retval;
  }