public static void batchRelateAll(
     ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) {
   InstanceList instances = modelRoot.getInstanceList(DescriptionQuery_c.class);
   synchronized (instances) {
     Iterator<NonRootModelElement> cursor = instances.iterator();
     while (cursor.hasNext()) {
       final DescriptionQuery_c inst = (DescriptionQuery_c) cursor.next();
       inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots);
     }
   }
 }
 private static DescriptionQuery_c findDescriptionQueryInstance(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   InstanceList instances = modelRoot.getInstanceList(DescriptionQuery_c.class);
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       DescriptionQuery_c x = (DescriptionQuery_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         if (x.ensureLoaded(loadComponent)) return x;
       }
     }
   }
   return null;
 }
  public static DescriptionQuery_c resolveInstance(ModelRoot modelRoot, java.util.UUID p_m_id) {
    InstanceList instances = modelRoot.getInstanceList(DescriptionQuery_c.class);
    DescriptionQuery_c source = null;
    synchronized (instances) {
      Object[] key = {p_m_id};
      source = (DescriptionQuery_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);

        return source;
      }
    }
    // there is no instance matching the id
    DescriptionQuery_c new_inst = new DescriptionQuery_c(modelRoot, p_m_id);
    return new_inst;
  }
 public static DescriptionQuery_c[] DescriptionQueryInstances(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   if (loadComponent) {
     PersistenceManager.ensureAllInstancesLoaded(modelRoot, DescriptionQuery_c.class);
   }
   InstanceList instances = modelRoot.getInstanceList(DescriptionQuery_c.class);
   Vector matches = new Vector();
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       DescriptionQuery_c x = (DescriptionQuery_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         if (x.ensureLoaded(loadComponent)) matches.add(x);
       }
     }
     if (matches.size() > 0) {
       DescriptionQuery_c[] ret_set = new DescriptionQuery_c[matches.size()];
       matches.copyInto(ret_set);
       return ret_set;
     } else {
       return new DescriptionQuery_c[0];
     }
   }
 }
 public static DescriptionQuery_c DescriptionQueryInstance(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   DescriptionQuery_c result = findDescriptionQueryInstance(modelRoot, test, loadComponent);
   if (result == null && loadComponent) {
     List pmcs = PersistenceManager.findAllComponents(modelRoot, DescriptionQuery_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 = findDescriptionQueryInstance(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;
 }
  // end declare accessors
  public static void checkClassConsistency(ModelRoot modelRoot) {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Description Query", //$NON-NLS-1$
        " Operation entered: Description Query::checkClassConsistency"); //$NON-NLS-1$
    if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$
      return;
    }
    DescriptionQuery_c[] objs =
        DescriptionQuery_c.DescriptionQueryInstances(modelRoot, null, false);

    for (int i = 0; i < objs.length; i++) {
      objs[i].checkConsistency();
    }
  }
 public static DescriptionQuery_c createProxy(
     ModelRoot modelRoot, java.util.UUID p_m_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(DescriptionQuery_c.class);
   DescriptionQuery_c new_inst = null;
   synchronized (instances) {
     Object[] key = {p_m_id};
     new_inst = (DescriptionQuery_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);
     }
   }
   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 DescriptionQuery_c(modelRoot, p_m_id);
     new_inst.m_contentPath = contentPath;
   }
   return new_inst;
 }
 public boolean evaluate(Object candidate) {
   DescriptionQuery_c selected = (DescriptionQuery_c) candidate;
   boolean retval = false;
   retval = (selected.getId().equals(m_p39593));
   return retval;
 }
  public boolean checkConsistency() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Description Query", //$NON-NLS-1$
        " Operation entered: Description Query::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 DescriptionQuery_c_test39592_c implements ClassQueryInterface_c {
      DescriptionQuery_c_test39592_c(java.util.UUID p39593) {
        m_p39593 = p39593;
      }

      private java.util.UUID m_p39593;

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

    DescriptionQuery_c[] objs39591 =
        DescriptionQuery_c.DescriptionQueryInstances(
            modelRoot, new DescriptionQuery_c_test39592_c(getId()));

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

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

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

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

    // Description Query is a subtype in association: rel.Numb = 9600
    // The supertype class is: Query
    class Query_c_test39597_c implements ClassQueryInterface_c {
      Query_c_test39597_c(java.util.UUID p39598) {
        m_p39598 = p39598;
      }

      private java.util.UUID m_p39598;

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

    Query_c[] objs39596 = Query_c.QueryInstances(modelRoot, new Query_c_test39597_c(getId()));

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

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

    return retval;
  }