// olga: use comatch after step ia done to get values of OUTPUT parameters of a rule
 String getValueOfOutputParameter(VarMember p, Rule r, OrdinaryMorphism comatch) {
   if (p != null && r != null && comatch != null) {
     Enumeration<GraphObject> rightObjs = comatch.getDomain();
     while (rightObjs.hasMoreElements()) {
       GraphObject obj = rightObjs.nextElement();
       if (obj.getAttribute() != null) {
         ValueTuple vt = (ValueTuple) obj.getAttribute();
         for (int i = 0; i < vt.getNumberOfEntries(); i++) {
           ValueMember vm = vt.getEntryAt(i);
           if (vm.isSet() && vm.getExpr().isVariable() && vm.getExprAsText().equals(p.getName())) {
             // we found an object obj inside of the RHS which uses the output parameter p,
             // now we will find an appropriate graph object
             // and to get the value of the output parameter
             GraphObject go = comatch.getImage(obj);
             ValueTuple vt_go = (ValueTuple) go.getAttribute();
             ValueMember vm_go = vt_go.getEntryAt(vm.getName());
             String parVal = vm_go.getExprAsText();
             System.out.println(
                 parVal
                     + "  is value of OUTPUT parameter: --"
                     + p.getName()
                     + "--  of rule: "
                     + r.getName());
             return parVal;
           }
         }
       }
     }
   }
   return null;
 }
  /**
   * Import a ColorGraph which is specified by String colorFileName into the by index specified
   * Graph of the specified GraGra.
   *
   * @param gra
   * @param graph
   * @param colorFileName is the full file name and must end with ".res"
   */
  private boolean importColorGraph2AGG(final GraGra gra, final Graph graph) {
    if (this.colorFileName.endsWith(".res")) {

      //			final List<Node> edges = new Vector<Node>();

      final List<Node> nodes = new Vector<Node>();
      nodes.addAll(graph.getNodesSet());

      for (int i = 0; i < nodes.size(); i++) {
        final Node n = nodes.get(i);
        if (n.getType().getName().equals("Node")) {

        } else if (n.getType().getName().equals("Edge")) {
          //					edges.add(n);
          nodes.remove(i);
          i--;
        } else {
          nodes.remove(i);
          i--;
        }
      }

      final File f = new File(this.colorFileName);
      FileInputStream fos = null;
      byte b[] = new byte[1024];
      int count = 0;

      try {
        fos = new FileInputStream(f);
        while (count != -1) {
          count = fos.read(b);
          if (count != -1) {
            String s = new String(b);

            int lineEnd = s.indexOf("\n");
            while (lineEnd != -1) {
              String str = s.substring(0, lineEnd);
              s = s.substring(lineEnd + 1, s.length() - 1);
              lineEnd = s.indexOf("\n");

              if (lineEnd == -1) {
                while (str.charAt(0) == ' ') {
                  str = str.substring(1, str.length());
                }

                String[] str_e = str.split("   ");

                for (int i = 0; i < str_e.length; i++) {
                  String color = str_e[i].trim();

                  Node node = nodes.get(i);
                  if (node.getAttribute() != null) {
                    ValueTuple val = (ValueTuple) node.getAttribute();
                    ValueMember mem = val.getValueMemberAt("color");
                    if (mem == null) mem = val.getValueMemberAt("Color");
                    if (mem != null) mem.setExprAsText(color);
                  }
                }
              }
            }
          }
        }
        return true;

      } catch (IOException e) {
      }
    }
    return false;
  }