public static void batchRelateAll(
     ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) {
   InstanceList instances = modelRoot.getInstanceList(ComponentInComponent_c.class);
   synchronized (instances) {
     Iterator<NonRootModelElement> cursor = instances.iterator();
     while (cursor.hasNext()) {
       final ComponentInComponent_c inst = (ComponentInComponent_c) cursor.next();
       inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots);
     }
   }
 }
 private static ComponentInComponent_c findComponentInComponentInstance(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   InstanceList instances = modelRoot.getInstanceList(ComponentInComponent_c.class);
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       ComponentInComponent_c x = (ComponentInComponent_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         if (x.ensureLoaded(loadComponent)) return x;
       }
     }
   }
   return null;
 }
 public static ComponentInComponent_c[] ComponentInComponentInstances(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   if (loadComponent) {
     PersistenceManager.ensureAllInstancesLoaded(modelRoot, ComponentInComponent_c.class);
   }
   InstanceList instances = modelRoot.getInstanceList(ComponentInComponent_c.class);
   Vector matches = new Vector();
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       ComponentInComponent_c x = (ComponentInComponent_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         if (x.ensureLoaded(loadComponent)) matches.add(x);
       }
     }
     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];
     }
   }
 }
  // end declare accessors
  public static void checkClassConsistency(ModelRoot modelRoot) {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Component in Component", //$NON-NLS-1$
        " Operation entered: Component in Component::checkClassConsistency"); //$NON-NLS-1$
    if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$
      return;
    }
    ComponentInComponent_c[] objs =
        ComponentInComponent_c.ComponentInComponentInstances(modelRoot, null, false);

    for (int i = 0; i < objs.length; i++) {
      objs[i].checkConsistency();
    }
  }
 public static ComponentInComponent_c ComponentInComponentInstance(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   ComponentInComponent_c result =
       findComponentInComponentInstance(modelRoot, test, loadComponent);
   if (result == null && loadComponent) {
     List pmcs = PersistenceManager.findAllComponents(modelRoot, ComponentInComponent_c.class);
     for (int i = 0; i < pmcs.size(); i++) {
       PersistableModelComponent component = (PersistableModelComponent) pmcs.get(i);
       if (!component.isLoaded()) {
         try {
           component.load(new NullProgressMonitor());
           result = findComponentInComponentInstance(modelRoot, test, loadComponent);
           if (result != null) return result;
         } catch (Exception e) {
           CorePlugin.logError("Error Loading component", e);
         }
       }
     }
   }
   if (result != null && loadComponent) {
     result.loadProxy();
   }
   return result;
 }
  public static ComponentInComponent_c[] getManyCN_CICsOnR4203(
      Component_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {
    if (targets == null || targets.length == 0 || targets[0] == null)
      return new ComponentInComponent_c[0];

    LinkedHashSet<ComponentInComponent_c> elementsSet = new LinkedHashSet<ComponentInComponent_c>();
    for (int i = 0; i < targets.length; i++) {
      if (loadComponent
          && targets[i] != null
          && targets[i].IsNestedThroughComponentInComponent == null) targets[i].loadProxy();
      ComponentInComponent_c associate = targets[i].IsNestedThroughComponentInComponent;
      if (targets[i] != null && associate != null && (test == null || test.evaluate(associate))) {
        if (elementsSet.add(associate)) {
          if (loadComponent) {
            associate.loadProxy();
          }
        }
      }
    }

    ComponentInComponent_c[] result = new ComponentInComponent_c[elementsSet.size()];
    elementsSet.toArray(result);
    return result;
  }
 public static ComponentInComponent_c createProxy(
     ModelRoot modelRoot,
     java.util.UUID p_m_id,
     java.util.UUID p_m_parent_id,
     String p_contentPath,
     IPath p_localPath) {
   ModelRoot resolvedModelRoot = ModelRoot.findModelRoot(modelRoot, p_contentPath, p_localPath);
   // if a model root was not resolved it is most likely
   // due to a missing file of the proxy, defualt back to
   // the original model root
   if (resolvedModelRoot != null) modelRoot = resolvedModelRoot;
   InstanceList instances = modelRoot.getInstanceList(ComponentInComponent_c.class);
   ComponentInComponent_c new_inst = null;
   synchronized (instances) {
     Object[] key = {p_m_id};
     new_inst = (ComponentInComponent_c) instances.get(key);
   }
   String contentPath = PersistenceUtil.resolveRelativePath(p_localPath, new Path(p_contentPath));
   if (modelRoot.isNewCompareRoot()) {
     // for comparisons we do not want to change
     // the content path
     contentPath = p_contentPath;
   }
   if (new_inst != null && !modelRoot.isCompareRoot()) {
     PersistableModelComponent pmc = new_inst.getPersistableComponent();
     if (pmc == null) {
       // dangling reference, redo this instance
       new_inst.batchUnrelate();
       // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
       new_inst.m_id = IdAssigner.preprocessUUID(p_m_id);
       // extract 28 bit value only
       new_inst.m_idLongBased = 0xfffffff & p_m_id.getLeastSignificantBits();
       // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
       new_inst.m_parent_id = IdAssigner.preprocessUUID(p_m_parent_id);
     }
   }
   if (new_inst == null) {
     // there is no instance matching the id, create a proxy
     // if the resource doesn't exist then this will be a dangling reference
     new_inst = new ComponentInComponent_c(modelRoot, p_m_id, p_m_parent_id);
     new_inst.m_contentPath = contentPath;
   }
   return new_inst;
 }
  public static ComponentInComponent_c resolveInstance(
      ModelRoot modelRoot, java.util.UUID p_m_id, java.util.UUID p_m_parent_id) {
    InstanceList instances = modelRoot.getInstanceList(ComponentInComponent_c.class);
    ComponentInComponent_c source = null;
    synchronized (instances) {
      Object[] key = {p_m_id};
      source = (ComponentInComponent_c) instances.get(key);
      if (source != null && !modelRoot.isCompareRoot()) {
        source.convertFromProxy();
        source.batchUnrelate();
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_id = IdAssigner.preprocessUUID(p_m_id);
        // extract 28 bit value only
        source.m_idLongBased = 0xfffffff & p_m_id.getLeastSignificantBits();
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_parent_id = IdAssigner.preprocessUUID(p_m_parent_id);

        return source;
      }
    }
    // there is no instance matching the id
    ComponentInComponent_c new_inst = new ComponentInComponent_c(modelRoot, p_m_id, p_m_parent_id);
    return new_inst;
  }
 public boolean evaluate(Object candidate) {
   ComponentInComponent_c selected = (ComponentInComponent_c) candidate;
   boolean retval = false;
   retval = (selected.getId().equals(m_p55678));
   return retval;
 }
  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;
  }