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];
    }
  }
示例#2
1
  public static InformalArgument_c[] getManyMSG_IAsOnR1013(
      MessageArgument_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

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

    ModelRoot modelRoot = targets[0].getModelRoot();

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

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      InformalArgument_c source =
          (InformalArgument_c) targets[i].backPointer_IsSubtypeInformalArgumentIsSubtype_R1013;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    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];
    }
  }
  public static AssignToMember_c[] getManyACT_AIsOnR603(
      Statement_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

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

    ModelRoot modelRoot = targets[0].getModelRoot();

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

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      AssignToMember_c source =
          (AssignToMember_c) targets[i].backPointer_IsSubtypeAssignToMemberIsSubtype_R603;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    if (matches.size() > 0) {
      AssignToMember_c[] ret_set = new AssignToMember_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new AssignToMember_c[0];
    }
  }
  public static TransientValueReference_c[] getManyV_TVLsOnR801(
      Value_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

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

    ModelRoot modelRoot = targets[0].getModelRoot();

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

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      TransientValueReference_c source =
          (TransientValueReference_c)
              targets[i].backPointer_IsSubtypeTransientValueReferenceIsSubtype_R801;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    if (matches.size() > 0) {
      TransientValueReference_c[] ret_set = new TransientValueReference_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new TransientValueReference_c[0];
    }
  }
  public static BridgeInvocation_c[] getManyACT_BRGsOnR674(
      Bridge_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new BridgeInvocation_c[0];

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

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      BridgeInvocation_c[] ret_set = new BridgeInvocation_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new BridgeInvocation_c[0];
    }
  }
  public static DescriptionQuery_c[] getManySQU_DEsOnR9600(
      Query_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

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

    ModelRoot modelRoot = targets[0].getModelRoot();

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

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      DescriptionQuery_c source =
          (DescriptionQuery_c) targets[i].backPointer_IsSubtypeDescriptionQueryIsSubtype_R9600;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    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];
    }
  }
示例#7
0
  public static final void fireEvent(GenericEvent e, Method m, Vector listeners)
      throws PropertyVetoException {
    Object[] snapshot = null;

    synchronized (listeners) {
      snapshot = new Object[listeners.size()];
      listeners.copyInto(snapshot);
    }

    // leighd 04/14/99 - modified for event debugging
    if (gDebugEvents) Engine.debugLog("Event : " + e.toString());

    Object params[] = new Object[] {e};

    for (int i = 0; i < snapshot.length; i++) {
      if ((e instanceof Consumable) && ((Consumable) e).isConsumed()) {
        // leighd 04/14/99
        // note that we don't catch the consumption of the
        // event until we've passed through the loop again,
        // so we reference i-1
        if (gDebugEvents) Engine.debugLog("Consumed By : " + snapshot[i - 1]);
        return;
      }
      try {
        m.invoke(snapshot[i], params);
      } catch (IllegalAccessException iae) {
        iae.printStackTrace();
      } catch (InvocationTargetException ite) {
        Throwable t = ite.getTargetException();
        if (t instanceof PropertyVetoException) throw ((PropertyVetoException) t);
        else t.printStackTrace();
      }
    }
  }
  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 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 ElementInMove_c[] getManyGD_EIMsOnR25(
      GraphicalElement_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

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

    ModelRoot modelRoot = targets[0].getModelRoot();

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

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      synchronized (targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25) {
        for (int j = 0;
            j < targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25.size();
            ++j) {
          ElementInMove_c source =
              (ElementInMove_c) targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25.get(j);
          if (source != null && (test == null || test.evaluate(source))) {
            matches.add(source);
          }
        }
      }
    }
    if (matches.size() > 0) {
      ElementInMove_c[] ret_set = new ElementInMove_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ElementInMove_c[0];
    }
  }
  public static ElementInMove_c[] getManyGD_EIMsOnR25(
      Model_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new ElementInMove_c[0];

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

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      ElementInMove_c[] ret_set = new ElementInMove_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ElementInMove_c[0];
    }
  }
  public static ComponentInComponent_c[] getManyCN_CICsOnR4202(
      Component_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

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

    ModelRoot modelRoot = targets[0].getModelRoot();

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

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      synchronized (targets[i].backPointer_CanNestComponentInComponentCanNest_R4202) {
        for (int j = 0;
            j < targets[i].backPointer_CanNestComponentInComponentCanNest_R4202.size();
            ++j) {
          ComponentInComponent_c source =
              (ComponentInComponent_c)
                  targets[i].backPointer_CanNestComponentInComponentCanNest_R4202.get(j);
          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 static TransientValueReference_c[] getManyV_TVLsOnR805(
      Variable_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new TransientValueReference_c[0];

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

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      TransientValueReference_c[] ret_set = new TransientValueReference_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new TransientValueReference_c[0];
    }
  }
  public static BridgeInvocation_c[] getManyACT_BRGsOnR674(
      Bridge_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

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

    ModelRoot modelRoot = targets[0].getModelRoot();

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

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      synchronized (targets[i].backPointer_BridgeInvocation_R674) {
        for (int j = 0; j < targets[i].backPointer_BridgeInvocation_R674.size(); ++j) {
          BridgeInvocation_c source =
              (BridgeInvocation_c) targets[i].backPointer_BridgeInvocation_R674.get(j);
          if (source != null && (test == null || test.evaluate(source))) {
            matches.add(source);
          }
        }
      }
    }
    if (matches.size() > 0) {
      BridgeInvocation_c[] ret_set = new BridgeInvocation_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new BridgeInvocation_c[0];
    }
  }
示例#15
0
  public static DataTypeInPackage_c[] getManyS_DIPsOnR39(
      DataType_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

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

    ModelRoot modelRoot = targets[0].getModelRoot();

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

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      synchronized (targets[i].backPointer_IsContainedInDataTypeInPackageIsContainedIn_R39) {
        for (int j = 0;
            j < targets[i].backPointer_IsContainedInDataTypeInPackageIsContainedIn_R39.size();
            ++j) {
          DataTypeInPackage_c source =
              (DataTypeInPackage_c)
                  targets[i].backPointer_IsContainedInDataTypeInPackageIsContainedIn_R39.get(j);
          if (source != null && (test == null || test.evaluate(source))) {
            matches.add(source);
          }
        }
      }
    }
    if (matches.size() > 0) {
      DataTypeInPackage_c[] ret_set = new DataTypeInPackage_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new DataTypeInPackage_c[0];
    }
  }
示例#16
0
  public static DataTypeInPackage_c[] getManyS_DIPsOnR39(
      DataTypePackage_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new DataTypeInPackage_c[0];

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

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      DataTypeInPackage_c[] ret_set = new DataTypeInPackage_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new DataTypeInPackage_c[0];
    }
  }
示例#17
0
 String[] openUrlAsList(String address) {
   Vector v = new Vector();
   try {
     URL url = new URL(address);
     InputStream in = url.openStream();
     BufferedReader br = new BufferedReader(new InputStreamReader(in));
     String line;
     while (true) {
       line = br.readLine();
       if (line == null) break;
       if (!line.equals("")) v.addElement(line);
     }
     br.close();
   } catch (Exception e) {
   }
   String[] lines = new String[v.size()];
   v.copyInto((String[]) lines);
   return lines;
 }
示例#18
0
 public static Graphnode_c[] GraphnodeInstances(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   Vector matches = new Vector();
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       Graphnode_c x = (Graphnode_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         matches.add(x);
       }
     }
     if (matches.size() > 0) {
       Graphnode_c[] ret_set = new Graphnode_c[matches.size()];
       matches.copyInto(ret_set);
       return ret_set;
     } else {
       return new Graphnode_c[0];
     }
   }
 }
示例#19
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];
     }
   }
 }
示例#20
0
  /**
   * Reads an XML element into a bean property by first locating the XML element corresponding to
   * this property.
   *
   * @param ob The bean whose property is being set
   * @param desc The property that will be set
   * @param nodes The list of XML items that may contain the property
   * @throws IOException If there is an error reading the document
   */
  public void readProperty(Object ob, PropertyDescriptor desc, NodeList nodes, NamedNodeMap attrs)
      throws IOException {
    int numAttrs = attrs.getLength();

    for (int i = 0; i < numAttrs; i++) {
      // See if the attribute name matches the property name
      if (namesMatch(desc.getName(), attrs.item(i).getNodeName())) {
        // Get the method used to set this property
        Method setter = desc.getWriteMethod();

        // If this object has no setter, don't bother writing it
        if (setter == null) continue;

        // Get the value of the property
        Object obValue = getObjectValue(desc, attrs.item(i).getNodeValue());
        if (obValue != null) {
          try {
            // Set the property value
            setter.invoke(ob, new Object[] {obValue});
          } catch (InvocationTargetException exc) {
            throw new IOException(
                "Error setting property " + desc.getName() + ": " + exc.toString());
          } catch (IllegalAccessException exc) {
            throw new IOException(
                "Error setting property " + desc.getName() + ": " + exc.toString());
          }
        }

        return;
      }
    }

    int numNodes = nodes.getLength();

    Vector arrayBuild = null;

    for (int i = 0; i < numNodes; i++) {
      Node node = nodes.item(i);

      // If this node isn't an element, skip it
      if (!(node instanceof Element)) continue;

      Element element = (Element) node;

      // See if the tag name matches the property name
      if (namesMatch(desc.getName(), element.getTagName())) {
        // Get the method used to set this property
        Method setter = desc.getWriteMethod();

        // If this object has no setter, don't bother writing it
        if (setter == null) continue;

        // Get the value of the property
        Object obValue = getObjectValue(desc, element);

        // 070201 MAW: Modified from change submitted by Steve Poulson
        if (setter.getParameterTypes()[0].isArray()) {
          if (arrayBuild == null) {
            arrayBuild = new Vector();
          }
          arrayBuild.addElement(obValue);

          // 070201 MAW: Go ahead and read through the rest of the nodes in case
          //             another one matches the array. This has the effect of skipping
          //             over the "return" statement down below
          continue;
        }

        if (obValue != null) {
          try {
            // Set the property value
            setter.invoke(ob, new Object[] {obValue});
          } catch (InvocationTargetException exc) {
            throw new IOException(
                "Error setting property " + desc.getName() + ": " + exc.toString());
          } catch (IllegalAccessException exc) {
            throw new IOException(
                "Error setting property " + desc.getName() + ": " + exc.toString());
          }
        }
        return;
      }
    }

    // If we build a vector of array members, convert the vector into
    // an array and save it in the property
    if (arrayBuild != null) {
      // Get the method used to set this property
      Method setter = desc.getWriteMethod();

      if (setter == null) return;

      Object[] obValues = (Object[]) Array.newInstance(desc.getPropertyType(), arrayBuild.size());

      arrayBuild.copyInto(obValues);

      try {
        setter.invoke(ob, new Object[] {obValues});
      } catch (InvocationTargetException exc) {
        throw new IOException("Error setting property " + desc.getName() + ": " + exc.toString());
      } catch (IllegalAccessException exc) {
        throw new IOException("Error setting property " + desc.getName() + ": " + exc.toString());
      }

      return;
    }
  }
示例#21
0
  /**
   * Reads XML element(s) into an indexed bean property by first locating the XML element(s)
   * corresponding to this property.
   *
   * @param ob The bean whose property is being set
   * @param desc The property that will be set
   * @param nodes The list of XML items that may contain the property
   * @throws IOException If there is an error reading the document
   */
  public void readIndexedProperty(
      Object ob, IndexedPropertyDescriptor desc, NodeList nodes, NamedNodeMap attrs)
      throws IOException {
    // Create a vector to hold the property values
    Vector v = new Vector();

    int numAttrs = attrs.getLength();

    for (int i = 0; i < numAttrs; i++) {
      // See if this attribute matches the property name
      if (namesMatch(desc.getName(), attrs.item(i).getNodeName())) {
        // Get the property value
        Object obValue = getObjectValue(desc, attrs.item(i).getNodeValue());

        if (obValue != null) {
          // Add the value to the list of values to be set
          v.addElement(obValue);
        }
      }
    }

    int numNodes = nodes.getLength();

    for (int i = 0; i < numNodes; i++) {
      Node node = nodes.item(i);

      // Skip non-element nodes
      if (!(node instanceof Element)) continue;

      Element element = (Element) node;

      // See if this element tag matches the property name
      if (namesMatch(desc.getName(), element.getTagName())) {
        // Get the property value
        Object obValue = getObjectValue(desc, element);

        if (obValue != null) {
          // Add the value to the list of values to be set
          v.addElement(obValue);
        }
      }
    }

    // Get the method used to set the property value
    Method setter = desc.getWriteMethod();

    // If this property has no setter, don't write it
    if (setter == null) return;

    // Create a new array of property values
    Object propArray = Array.newInstance(desc.getPropertyType().getComponentType(), v.size());

    // Copy the vector into the array
    v.copyInto((Object[]) propArray);

    try {
      // Store the array of property values
      setter.invoke(ob, new Object[] {propArray});
    } catch (InvocationTargetException exc) {
      throw new IOException("Error setting property " + desc.getName() + ": " + exc.toString());
    } catch (IllegalAccessException exc) {
      throw new IOException("Error setting property " + desc.getName() + ": " + exc.toString());
    }
  }