Package fbench.graph.model

Source Code of fbench.graph.model.Device

//Copyright (c)2005 Holobloc Inc.
//Contributed to the OOONEIDA FBench Project under the terms of the Common Public License.
//See http://oooneida-wb.sourceforge.net.
package fbench.graph.model;

import java.util.Vector;

import fbench.graph.GraphElement;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
* A GraphModel for a Device instance.
*
* @author JHC
* @version 20051114/JHC
*/
public class Device extends Resource {

  public Device() {
    super();
  }

  public Device(Element el) {
    super(el);
  }

  protected void addResources(Vector graph, Element el) {
    NodeList nl = el.getElementsByTagName("Resource");
    for (int i = 0; i < nl.getLength(); i++) {
      GraphElement ge = GraphElement.forElement((Element) nl.item(i));
      if (ge != null)
        graph.addElement(ge);
    }

  }

  public Vector getGraph() {
    Vector graph = super.getGraph();
    addResources(graph, getTypeDocElement());
    addResources(graph, getElement());
    return graph;
  }

  /**
   * Returns the suffix (including the initial period) for the element's Type
   * file.
   */
  protected String getTypeSuffix() {
    return ".dev";
  }
}
TOP

Related Classes of fbench.graph.model.Device

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.