/* * Created on 10/06/2003 */ package graph; import java.util.Vector; /** * @author André Santanchè */ public class Vertex implements heap.HeapElement { private String label; private Object index; private int d = 0; private Vertex pi = null; private Vector e; public Vertex(String label) { this.label = label; } public int getKey() { return d; } public void setKey(int key) { d = key; } public Object getIndex() { return index; } public void setIndex(Object index) { this.index = index; } public int getD() { return d; } public void setD(int d) { this.d = d; } public Vertex getPi() { return pi; } public void setPi(Vertex pi) { this.pi = pi; } public Edge[] getEdges() { return (e == null) ? null : (Edge[])e.toArray(new Edge[0]); } public void setEdges(Edge edgeList[]) { System.out.println(getLabel() + "; " + edgeList.length); if (edgeList == null) e = new Vector(); else { e = new Vector(edgeList.length); for (int i = 0; i < edgeList.length; i++) e.addElement(edgeList[i]); } } public void addEdge(Edge edg) { if (e == null) e = new Vector(); e.addElement(edg); } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public String toString() { return label; } }