public static ComponentInComponent_c[] getManyCN_CICsOnR4202(
      Component_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new ComponentInComponent_c[0];

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

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      ComponentInComponent_c[] ret_set = new ComponentInComponent_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ComponentInComponent_c[0];
    }
  }
  public boolean delete() {
    boolean result = super.delete();
    boolean delete_error = false;
    String errorMsg =
        "The following relationships were not torn down by the Component in Component.dispose call: ";
    Component_c testR4202Inst = Component_c.getOneC_COnR4202(this, false);

    if (testR4202Inst != null) {
      delete_error = true;
      errorMsg = errorMsg + "4202 ";
    }
    Component_c testR4203Inst = Component_c.getOneC_COnR4203(this, false);

    if (testR4203Inst != null) {
      delete_error = true;
      errorMsg = errorMsg + "4203 ";
    }
    if (delete_error == true) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(ILogger.DELETE, "Component in Component", errorMsg);
      } else {
        Exception e = new Exception();
        e.fillInStackTrace();
        CorePlugin.logError(errorMsg, e);
      }
    }
    return result;
  }
  public void unrelateAcrossR4202From(Component_c target, boolean notifyChanges) {
    if (target == null) return;

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

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

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

    if (CanBeNestedInComponent != null) {

      m_parent_id = CanBeNestedInComponent.getId();
      if (IdAssigner.NULL_UUID.equals(m_parent_id)) {
        m_parent_id = CanBeNestedInComponent.getIdCachedValue();
      }
      CanBeNestedInComponent = null;
      target.removeRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "4202", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
  public static ComponentResultSet_c[] getManyPE_CRSsOnR8007(
      Component_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new ComponentResultSet_c[0];

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

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      ComponentResultSet_c[] ret_set = new ComponentResultSet_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ComponentResultSet_c[0];
    }
  }
 public static ComponentResultSet_c getOnePE_CRSOnR8007(
     Component_c target, ClassQueryInterface_c test) {
   if (target != null) {
     return getOnePE_CRSOnR8007(target.getModelRoot(), target, test);
   }
   return null;
 }
 public static ComponentInComponent_c getOneCN_CICOnR4202(
     Component_c target, ClassQueryInterface_c test) {
   if (target != null) {
     return getOneCN_CICOnR4202(target.getModelRoot(), target, test);
   }
   return null;
 }
  public void relateAcrossR4202To(Component_c target, boolean notifyChanges) {
    if (target == null) return;

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

    if (CanBeNestedInComponent != target) {

      Object oldKey = getInstanceKey();

      if (CanBeNestedInComponent != null) {

        CanBeNestedInComponent.clearBackPointerR4202To(this);

        if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$
          Ooaofooa.log.println(
              ILogger.CONSISTENCY,
              "ComponentInComponent_c.relateAcrossR4202To(Component_c target)",
              "Relate performed across R4202 from Component in Component to Component without unrelate of prior instance.");
        }
      }

      CanBeNestedInComponent = target;
      if (IdAssigner.NULL_UUID.equals(target.getId())) {
        // do not update cached value
      } else {
        // update cached value
        m_parent_id = target.getIdCachedValue();
      }
      updateInstanceKey(oldKey, getInstanceKey());
      target.setBackPointerR4202To(this);
      target.addRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "4202", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
  public void batchRelate(
      ModelRoot modelRoot, boolean relateProxies, boolean notifyChanges, boolean searchAllRoots) {
    InstanceList instances = null;
    ModelRoot baseRoot = modelRoot;

    if (CanBeNestedInComponent == null) {
      // R4202
      Component_c relInst55675 =
          (Component_c) baseRoot.getInstanceList(Component_c.class).get(new Object[] {m_parent_id});
      // if there was no local element, check for any global elements
      // failing that proceed to check other model roots
      if (relInst55675 == null) {
        relInst55675 =
            (Component_c)
                Ooaofooa.getDefaultInstance()
                    .getInstanceList(Component_c.class)
                    .get(new Object[] {m_parent_id});
      }
      if (relInst55675 == 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;
          }
          relInst55675 =
              (Component_c)
                  roots[i].getInstanceList(Component_c.class).get(new Object[] {m_parent_id});
          if (relInst55675 != null) break;
        }
      }
      // synchronized
      if (relInst55675 != null) {
        if (relateProxies || !isProxy() || (inSameComponent(this, relInst55675) && !isProxy())) {
          relInst55675.relateAcrossR4202To(this, notifyChanges);
        }
      }
    }
  }
 public static ComponentInComponent_c getOneCN_CICOnR4203(
     Component_c target, boolean loadComponent) {
   if (target != null) {
     if (loadComponent) {
       target.loadProxy();
       if (target.IsNestedThroughComponentInComponent != null) {
         target.IsNestedThroughComponentInComponent.loadProxy();
       }
     }
     return target.IsNestedThroughComponentInComponent;
   } else {
     return null;
   }
 }
  // declare transform functions
  public void Dispose() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Component Result Set",
        " Operation entered: ComponentResultSet::Dispose");
    final ModelRoot modelRoot = getModelRoot();
    Component_c v_component = Component_c.getOneC_COnR8007(this);

    ComponentVisibility_c[] v_elemVis = ComponentVisibility_c.getManyPE_CVSsOnR8008(this);

    ComponentVisibility_c v_elemV = null;
    for (int i37247 = 0; i37247 < v_elemVis.length; i37247++) {
      v_elemV = v_elemVis[i37247];

      PackageableElement_c v_pe = PackageableElement_c.getOnePE_PEOnR8004(v_elemV);

      if (v_elemV != null) {
        v_elemV.unrelateAcrossR8004From(v_component);
        v_elemV.unrelateAcrossR8004From(v_pe);
      } else {
        Throwable t = new Throwable();
        t.fillInStackTrace();
        CorePlugin.logError("Unrelate using attempted on null link class instance.", t);
      }

      this.unrelateAcrossR8008From(v_elemV);

      if (v_elemV != null) {
        // get the location of this element in the instance list
        // before deleting
        if (v_elemV.delete()) {
          Ooaofooa.getDefaultInstance()
              .fireModelElementDeleted(
                  new BaseModelDelta(Modeleventnotification_c.DELTA_DELETE, v_elemV));
        }
      } else {
        Throwable t = new Throwable();
        t.fillInStackTrace();
        CorePlugin.logError("Delete attempted on null instance.", t);
      }
    }

    this.unrelateAcrossR8007From(v_component);

    if (delete()) {
      Ooaofooa.getDefaultInstance()
          .fireModelElementDeleted(new BaseModelDelta(Modeleventnotification_c.DELTA_DELETE, this));
    }
  } // End dispose
 public void setComponentOrderInChildListR4203(Component_c target, int index) {
   unrelateAcrossR4203From(target);
   Component_c[] elements = Component_c.getManyC_CsOnR4203(this);
   int count = 0;
   for (int i = 0; i < elements.length; i++) {
     if (count >= index) {
       unrelateAcrossR4203From((Component_c) elements[i]);
     }
     count++;
   }
   relateAcrossR4203To(target);
   count = 0;
   for (int i = 0; i < elements.length; i++) {
     if (count >= index) {
       relateAcrossR4203To((Component_c) elements[i]);
     }
     count++;
   }
 }
  public boolean checkConsistency() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Component in Component", //$NON-NLS-1$
        " Operation entered: Component in Component::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 ComponentInComponent_c_test55677_c implements ClassQueryInterface_c {
      ComponentInComponent_c_test55677_c(java.util.UUID p55678) {
        m_p55678 = p55678;
      }

      private java.util.UUID m_p55678;

      public boolean evaluate(Object candidate) {
        ComponentInComponent_c selected = (ComponentInComponent_c) candidate;
        boolean retval = false;
        retval = (selected.getId().equals(m_p55678));
        return retval;
      }
    }

    ComponentInComponent_c[] objs55676 =
        ComponentInComponent_c.ComponentInComponentInstances(
            modelRoot, new ComponentInComponent_c_test55677_c(getId()));

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

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

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

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

    // Component in Component is a referring class in association: rel.Numb = 4202
    // The participating class is: Component
    class Component_c_test55682_c implements ClassQueryInterface_c {
      Component_c_test55682_c(java.util.UUID p55683) {
        m_p55683 = p55683;
      }

      private java.util.UUID m_p55683;

      public boolean evaluate(Object candidate) {
        Component_c selected = (Component_c) candidate;
        boolean retval = false;
        retval = (selected.getId().equals(m_p55683));
        return retval;
      }
    }

    Component_c[] objs55681 =
        Component_c.ComponentInstances(modelRoot, new Component_c_test55682_c(getParent_id()));

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

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

    // Component in Component is a participating class in association: rel.Numb = 4203
    // Object: Component
    class Component_c_test55685_c implements ClassQueryInterface_c {
      Component_c_test55685_c(java.util.UUID p55686) {
        m_p55686 = p55686;
      }

      private java.util.UUID m_p55686;

      public boolean evaluate(Object candidate) {
        Component_c selected = (Component_c) candidate;
        boolean retval = false;
        retval = (selected.getNestedcomponent_id().equals(m_p55686));
        return retval;
      }
    }

    Component_c[] objs55684 =
        Component_c.ComponentInstances(modelRoot, new Component_c_test55685_c(getId()));

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

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

    return retval;
  }
 public boolean evaluate(Object candidate) {
   Component_c selected = (Component_c) candidate;
   boolean retval = false;
   retval = (selected.getId().equals(m_p55683));
   return retval;
 }
 public long getParent_idLongBased() {
   if (CanBeNestedInComponent != null) {
     return CanBeNestedInComponent.getIdLongBased();
   }
   return 0;
 }
 public java.util.UUID getParent_id() {
   if (CanBeNestedInComponent != null) {
     return CanBeNestedInComponent.getId();
   }
   return IdAssigner.NULL_UUID;
 }
 public java.util.UUID getId() {
   if (HeldByComponent != null) {
     return HeldByComponent.getId();
   }
   return IdAssigner.NULL_UUID;
 }
 public long getIdLongBased() {
   if (HeldByComponent != null) {
     return HeldByComponent.getIdLongBased();
   }
   return 0;
 }
 public void unrelateAcrossR4203From(Component_c target, boolean notifyChanges) {
   if (target != null) {
     target.unrelateAcrossR4203From(this, notifyChanges);
   }
 }
  public boolean checkConsistency() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Component Result Set", //$NON-NLS-1$
        " Operation entered: Component Result Set::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 ComponentResultSet_c_test39974_c implements ClassQueryInterface_c {
      ComponentResultSet_c_test39974_c(String p39975, int p39976, java.util.UUID p39977) {
        m_p39975 = p39975;
        m_p39976 = p39976;
        m_p39977 = p39977;
      }

      private String m_p39975;
      private int m_p39976;
      private java.util.UUID m_p39977;

      public boolean evaluate(Object candidate) {
        ComponentResultSet_c selected = (ComponentResultSet_c) candidate;
        boolean retval = false;
        retval =
            (selected.getName().equals(m_p39975))
                & (selected.getType() == (m_p39976))
                & (selected.getId().equals(m_p39977));
        return retval;
      }
    }

    ComponentResultSet_c[] objs39973 =
        ComponentResultSet_c.ComponentResultSetInstances(
            modelRoot, new ComponentResultSet_c_test39974_c(getName(), getType(), getId()));

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

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

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

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Component Result Set", //$NON-NLS-1$
            "Consistency: Object: Component Result Set: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs39973.length)
                + " Name: "
                + getName()
                + " Type: "
                + Integer.toString(getType())
                + " Id: "
                + "Not Printable"); //$NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Component Result Set: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs39973.length)
                + " Name: "
                + getName()
                + " Type: "
                + Integer.toString(getType())
                + " Id: "
                + "Not Printable",
            e); //$NON-NLS-1$
      }
      retval = false;
    }

    // Component Result Set is a referring class in association: rel.Numb = 8007
    // The participating class is: Component
    class Component_c_test39981_c implements ClassQueryInterface_c {
      Component_c_test39981_c(java.util.UUID p39982) {
        m_p39982 = p39982;
      }

      private java.util.UUID m_p39982;

      public boolean evaluate(Object candidate) {
        Component_c selected = (Component_c) candidate;
        boolean retval = false;
        retval = (selected.getId().equals(m_p39982));
        return retval;
      }
    }

    Component_c[] objs39980 =
        Component_c.ComponentInstances(modelRoot, new Component_c_test39981_c(getId()));

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

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

    // Component Result Set is a participating class in association: rel.Numb = 8008
    // Object: Component Visibility
    return retval;
  }
 public void unrelateAcrossR4203From(Component_c target) {
   if (target != null) {
     target.unrelateAcrossR4203From(this, true);
   }
 }
 public void relateAcrossR4203To(Component_c target, boolean notifyChanges) {
   if (target != null) {
     target.relateAcrossR4203To(this, notifyChanges);
   }
 }
 public void relateAcrossR4203To(Component_c target) {
   if (target != null) {
     target.relateAcrossR4203To(this, true);
   }
 }
 public static ComponentResultSet_c getOnePE_CRSOnR8007(
     Component_c target, boolean loadComponent) {
   return getOnePE_CRSOnR8007(target.getModelRoot(), target, null, loadComponent);
 }
 public static ComponentInComponent_c getOneCN_CICOnR4202(
     Component_c target, boolean loadComponent) {
   return getOneCN_CICOnR4202(target.getModelRoot(), target, null, loadComponent);
 }