コード例 #1
0
 private void processRule(ReactionRule r) throws SaveFailedException {
   if (!iteratorsMatched(r.getRedex().getRoots().iterator(), r.getReactum().getRoots().iterator()))
     throw new SaveFailedException("Same number of roots required in redex and reactum");
   if (namedRules) write("%rule r_" + (i++) + " "); /* XXX FIXME */
   processBigraph(r.getRedex(), false);
   write(" -> ");
   processBigraph(r.getReactum(), false);
   write(";\n");
 }
コード例 #2
0
  private void processNames(SimulationSpec s) throws SaveFailedException {
    ArrayList<String> names = new ArrayList<String>();
    String name;
    for (ReactionRule r : s.getRules()) {
      for (IInnerName i : r.getRedex().getInnerNames()) {
        name = "%innername " + normaliseName(i.getName());
        if (!validateSameName(names, name)) {
          names.add(name);
        }
      }
      for (IOuterName o : r.getRedex().getOuterNames()) {
        name = "%outername " + normaliseName(o.getName());
        if (!validateSameName(names, name)) {
          names.add(name);
        }
      }
      for (IInnerName i : r.getReactum().getInnerNames()) {
        name = "%innername " + normaliseName(i.getName());
        if (!validateSameName(names, name)) {
          names.add(name);
        }
      }
      for (IOuterName o : r.getReactum().getOuterNames()) {
        name = "%outername " + normaliseName(o.getName());
        if (!validateSameName(names, name)) {
          names.add(name);
        }
      }
    }
    for (IInnerName i : s.getModel().getInnerNames()) {
      name = "%innername " + normaliseName(i.getName());
      if (!validateSameName(names, name)) {
        names.add(name);
      }
    }
    for (IOuterName o : s.getModel().getOuterNames()) {
      name = "%outername " + normaliseName(o.getName());
      if (!validateSameName(names, name)) {
        names.add(name);
      }
    }
    Collections.sort(names);

    if (names.size() == 0) return;
    write("# Names\n");
    for (String n : names) write(n + ";\n");
    write("\n");
  }
コード例 #3
0
 private void processSignature(SimulationSpec ss) throws SaveFailedException {
   write("# Controls\n");
   if (recProcessSignature(new ArrayList<String>(), ss.getSignature())) {
     recHandleParams(ss.getModel());
     for (ReactionRule r : ss.getRules()) {
       recHandleParams(r.getRedex());
       recHandleParams(r.getReactum());
     }
   }
   write("\n");
 }