public static InstanceStateMachine_c[] getManySM_ISMsOnR518(
      ModelClass_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null)
      return new InstanceStateMachine_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();
    if (loadComponent) {
      // Containment Relation
      PersistableModelComponent[] pmcs = new PersistableModelComponent[targets.length];
      for (int i = 0; i < targets.length; i++) {
        pmcs[i] = targets[i].getPersistableComponent();
      }
      PersistenceManager.ensureAllChildInstancesLoaded(
          pmcs, modelRoot, InstanceStateMachine_c.class);
    }

    InstanceList instances = modelRoot.getInstanceList(InstanceStateMachine_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      InstanceStateMachine_c source =
          (InstanceStateMachine_c) targets[i].backPointer_InstanceStateMachine_R518;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    if (matches.size() > 0) {
      InstanceStateMachine_c[] ret_set = new InstanceStateMachine_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new InstanceStateMachine_c[0];
    }
  }
  public static InstanceStateMachine_c getOneSM_ISMOnR518(
      ModelRoot modelRoot, ModelClass_c target, ClassQueryInterface_c test, boolean loadComponent) {
    InstanceStateMachine_c result = null;

    result = find_getOneSM_ISMOnR518(modelRoot, target, test);
    if (result == null && (loadComponent)) {
      // Containment Relation
      List comps =
          PersistenceManager.findAllChildComponents(
              target.getPersistableComponent(), modelRoot, InstanceStateMachine_c.class);
      for (int i = 0; i < comps.size(); i++) {
        PersistableModelComponent component = (PersistableModelComponent) comps.get(i);
        if (!component.isLoaded()) {
          try {
            component.load(new NullProgressMonitor());
            result = find_getOneSM_ISMOnR518(modelRoot, target, test);
            if (result != null) return result;
          } catch (Exception e) {
            CorePlugin.logError("Error Loading component", e);
          }
        }
      }
    }

    return result;
  }
예제 #3
0
 public static InformalArgument_c[] InformalArgumentInstances(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   if (loadComponent) {
     PersistenceManager.ensureAllInstancesLoaded(modelRoot, InformalArgument_c.class);
   }
   InstanceList instances = modelRoot.getInstanceList(InformalArgument_c.class);
   Vector matches = new Vector();
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       InformalArgument_c x = (InformalArgument_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         if (x.ensureLoaded(loadComponent)) matches.add(x);
       }
     }
     if (matches.size() > 0) {
       InformalArgument_c[] ret_set = new InformalArgument_c[matches.size()];
       matches.copyInto(ret_set);
       return ret_set;
     } else {
       return new InformalArgument_c[0];
     }
   }
 }
예제 #4
0
 public static InformalArgument_c InformalArgumentInstance(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   InformalArgument_c result = findInformalArgumentInstance(modelRoot, test, loadComponent);
   if (result == null && loadComponent) {
     List pmcs = PersistenceManager.findAllComponents(modelRoot, InformalArgument_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 = findInformalArgumentInstance(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;
 }