Exemplo n.º 1
0
 public void load(XMLElement myElement, XMLLoader loader)
     throws XMLTreeException, IOException, XMLInvalidInputException {
   super.load(myElement, loader);
   gamma = myElement.getAttribute("gamma").getFloatValue();
   random_chance = myElement.getAttribute("random-chance").getFloatValue();
   q_table = (float[][][][]) XMLArray.loadArray(this, loader);
   // v_table=(float[][][])XMLArray.loadArray(this,loader);
   count = (Vector) XMLArray.loadArray(this, loader, this);
   // p_table=(Vector)XMLArray.loadArray(this,loader,this);
 }
Exemplo n.º 2
0
		public void load (XMLElement myElement,XMLLoader loader) throws XMLTreeException,IOException,XMLInvalidInputException
		{	pos=myElement.getAttribute("pos").getIntValue();
		   	loadData.oldTlId=myElement.getAttribute("tl-id").getIntValue();
			loadData.destNodeId=myElement.getAttribute("destination").getIntValue();
		   	light=myElement.getAttribute("light").getBoolValue();
			loadData.newTlId=myElement.getAttribute("newtl-id").getIntValue();
			pos_new=myElement.getAttribute("new-pos").getIntValue();
			Ktl=myElement.getAttribute("ktl").getIntValue();
			value=myElement.getAttribute("value").getFloatValue(); 
		}
Exemplo n.º 3
0
 public void load(XMLElement myElement, XMLLoader loader)
     throws XMLTreeException, IOException, XMLInvalidInputException {
   super.load(myElement, loader);
   width = myElement.getAttribute("width").getIntValue();
   alphaRoads = (Road[]) XMLArray.loadArray(this, loader);
   loadData.roads = (int[]) XMLArray.loadArray(this, loader);
   loadData.signconfigs = (int[][]) XMLArray.loadArray(this, loader);
   loadData.signs = (int[]) XMLArray.loadArray(this, loader);
 }
Exemplo n.º 4
0
  /**
   * Writes an XML element.
   *
   * @param xml the non-null XML element to write.
   * @param indent how many spaces to indent the element.
   */
  public void write(XMLElement xml, int indent) throws IOException {
    for (int i = 0; i < indent; i++) {
      this.writer.print(' ');
    }

    if (xml.getName() == null) {
      if (xml.getContent() != null) {
        this.writeEncoded(xml.getContent()); // aspect(xml.getContent(), "xml.getContent() - 111");
        this.writer.println();
      }
    } else {
      this.writer.print('<');
      this.writer.print(xml.getName()); // aspect(xml.getName(), "xml.getName() - 116");
      Enumeration _enum = xml._enumerateAttributeNames();

      while (_enum.hasMoreElements()) {
        String key = (String) _enum.nextElement();
        String value = xml.getAttribute(key);
        this.writer.print(" " + key + "=\""); // aspect(key, "key - 122");
        this.writeEncoded(value); // aspect(value, "value - 123");
        this.writer.print('"');
      }

      if ((xml.getContent() != null) && (xml.getContent().length() > 0)) {
        writer.print('>');
        this.writeEncoded(xml.getContent()); // aspect(xml.getContent(), "xml.getContent() - 130");
        writer.println("</" + xml.getName() + '>'); // aspect(xml.getName(), "xml.getName() - 131");
      } else if (xml.hasChildren()) {
        writer.println('>');
        _enum = xml._enumerateChildren();

        while (_enum.hasMoreElements()) {
          XMLElement child = (XMLElement) _enum.nextElement();
          this.write(child, indent + 4);
        }

        for (int i = 0; i < indent; i++) {
          this.writer.print(' ');
        }

        this.writer.println(
            "</" + xml.getName() + ">"); // aspect(xml.getName(), "xml.getName() - 138");
      } else {
        this.writer.println("/>");
      }
    }

    this.writer.flush();
  }
Exemplo n.º 5
0
  /**
   * Private constructor. Use instantiator
   *
   * @param root Description of the Parameter
   */
  private RouteAdv(Element root) {
    if (!XMLElement.class.isInstance(root)) {
      throw new IllegalArgumentException(getClass().getName() + " only supports XLMElement");
    }

    XMLElement doc = (XMLElement) root;

    String doctype = doc.getName();

    String typedoctype = "";
    Attribute itsType = doc.getAttribute("type");

    if (null != itsType) {
      typedoctype = itsType.getValue();
    }

    if (!doctype.equals(getAdvertisementType()) && !getAdvertisementType().equals(typedoctype)) {
      throw new IllegalArgumentException(
          "Could not construct : "
              + getClass().getName()
              + "from doc containing a "
              + doc.getName());
    }

    Enumeration elements = doc.getChildren();

    while (elements.hasMoreElements()) {
      XMLElement elem = (XMLElement) elements.nextElement();

      if (!handleElement(elem)) {
        if (LOG.isEnabledFor(Level.DEBUG)) {
          LOG.debug("Unhandled Element: " + elem.toString());
        }
      }
    }

    // HACK Compatibility

    setDestPeerID(getDestPeerID());

    // Sanity Check!!!

    if (hasALoop()) {
      throw new IllegalArgumentException("Route contains a loop!");
    }
  }
Exemplo n.º 6
0
		public void load (XMLElement myElement,XMLLoader loader) throws XMLTreeException,IOException,XMLInvalidInputException
		{	pos=myElement.getAttribute("pos").getIntValue();
		   	loadData.tlId=myElement.getAttribute("tl-id").getIntValue();
		}
Exemplo n.º 7
0
 public void load(XMLElement myElement, XMLLoader loader)
     throws XMLTreeException, IOException, XMLInvalidInputException {
   ruType = myElement.getAttribute("ru-type").getIntValue();
   freq = myElement.getAttribute("freq").getFloatValue();
 }