コード例 #1
0
  // ------------------------------------------------------------------------------------------------------------------
  // ------------------------------------------------------------------------------------------------------------------
  private void translateScript(Element rootElement) {
    /*if the root element is of type "xscript" thn we interpret it's children*/
    if (rootElement.getTagName().toLowerCase().equals(ROOT_ELEMENT)) {
      NodeList children = rootElement.getChildNodes();

      for (int i = 0; i < children.getLength(); i++) {
        Node child = children.item(i);

        /*check for correct type*/
        if (child.getNodeType() != Node.ELEMENT_NODE) continue;

        /*interpret the child*/
        translateScript(child.castToElement());
      }
      /*if not then we simply interpret the element*/
    } else {
      /*get the command associated with the element*/
      XScriptCommand command = this.commandHandlers.get(rootElement.getNodeName().toLowerCase());

      if (command == null) return;

      /*if the command exists, then interpret the element*/
      command.handleCommand(rootElement, this);
    }
  }
コード例 #2
0
 // ------------------------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------------------------
 public void removeCommand(XScriptCommand command) {
   this.commandHandlers.remove(command.commandName().toLowerCase());
 }
コード例 #3
0
 // ------------------------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------------------------
 public void addCommand(XScriptCommand command) {
   this.commandHandlers.put(command.commandName().toLowerCase(), command);
 }