Exemplo n.º 1
0
  void parseFormalism(Element f) {
    NodeList list;
    Node head;

    Hashtable prophash = new Hashtable();

    formalism = new Formalism(f.getAttribute("name"));

    String description = f.getAttribute("description");
    if (!description.equals("")) formalism.setDescription(description);

    String structure = f.getAttribute("class");
    if (!structure.equals("")) formalism.setStructureClass(structure);

    NodeList childs = f.getChildNodes();
    for (int j = 0; j < childs.getLength(); j++)
      if (childs.item(j).getNodeType() == Node.ELEMENT_NODE) {
        Element child = (Element) childs.item(j);
        if (child.getNodeName().equals("formalism-info")) parseFormalismInfo(child);

        if (child.getNodeName().equals("connector-types")) parseConnectors(child.getChildNodes());
        if (child.getNodeName().equals("node-types")) parseNodes(child.getChildNodes());
        if (child.getNodeName().equals("arrow-types")) parseArrows(child.getChildNodes());
        if (child.getNodeName().equals("action")) formalism.addActionDesc(parseAction(child));
        if (child.getNodeName().equals("graphic-element")) {
          String graphicClass = child.getAttribute("class");
          // if (!graphicClass.equals(""))
          //    nd.setGraphicClass(graphicClass);
          // System.err.println("nodeselement2"+name+" "+nd.getGraphicClass());
          Hashtable graphprop = new Hashtable();
          NodeList graphproplist = child.getChildNodes();
          for (int m = 0; m < graphproplist.getLength(); m++)
            if (graphproplist.item(m).getNodeType() == Node.ELEMENT_NODE) {
              Element prop = (Element) graphproplist.item(m);
              if (prop.getNodeName().equals("property")) addProperty(graphprop, prop);
            }
          formalism.setGraphicProperties(graphprop);
          // System.out.println("graphicProperties: " + graphprop);
        }
        if (child.getNodeName().equals("property")) {
          addProperty(prophash, child);
          formalism.setProperties(prophash);
        }
      }
  }