コード例 #1
0
 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;
 }
コード例 #2
0
 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];
     }
   }
 }