uci.graph
Class DefaultGraphModel

java.lang.Object
  |
  +--uci.graph.MutableGraphSupport
        |
        +--uci.graph.DefaultGraphModel

public class DefaultGraphModel
extends MutableGraphSupport
implements Serializable

This interface provides a facade to a net-level representation. Similiar in concept to the Swing class TreeModel. This implementation of GraphModel uses the GEF classes NetList, NetNode, NetPort, and NetEdge. If you implement your own GraphModel, you can use your own application-specific classes.

See Also:
NetList, NetNode, NetPort, NetEdge, AdjacencyMatrixGraphModel, uci.graph.demo.WordTransforms, Serialized Form

Field Summary
protected  NetList _netList
           
 
Fields inherited from class uci.graph.MutableGraphSupport
_graphListeners
 
Constructor Summary
DefaultGraphModel()
           
DefaultGraphModel(NetList nl)
           
 
Method Summary
 void addEdge(Object edge)
          Add the given edge to the graph, if valid.
 void addNode(Object node)
          Add the given node to the graph, if valid.
 boolean canAddEdge(Object edge)
          Return true if the given object is a valid edge in this graph
 boolean canAddNode(Object node)
          Return true if the given object is a valid node in this graph
 boolean canConnect(Object srcPort, Object destPort)
          Return true if the two given ports can be connected by a kind of edge to be determined by the ports.
 boolean canConnect(Object srcPort, Object destPort, Class edgeClass)
          Return true if the two given ports can be connected by the given kind of edge.
 Object connect(Object srcPort, Object destPort)
          Contruct and add a new edge of a kind determined by the ports
 Object connect(Object srcPort, Object destPort, Class edgeClass)
          Contruct and add a new edge of the given kind
protected  Object connectInternal(NetPort s, NetPort d, NetEdge e)
           
 Object getDestPort(Object edge)
          Return the other end of an edge
 Vector getEdges()
          Return all nodes in the graph
 Vector getInEdges(Object port)
          Return all edges going to given port
 NetList getNetList()
           
 Vector getNodes()
          Return all nodes in the graph
 Vector getOutEdges(Object port)
          Return all edges going from given port
 Object getOwner(Object port)
          Return the node or edge that owns the given port
 Vector getPorts(Object nodeOrEdge)
          Return all ports on node or edge
 Object getSourcePort(Object edge)
          Return one end of an edge
 boolean OK()
           
 void removeEdge(Object edge)
          Remove the given edge from the graph.
 void removeNode(Object node)
          Remove the given node from the graph.
 void setNetList(NetList nl)
           
 
Methods inherited from class uci.graph.MutableGraphSupport
addGraphEventListener, containsEdge, containsEdgePort, containsNode, containsNodePort, containsPort, fireEdgeAdded, fireEdgeRemoved, fireGraphChanged, fireNodeAdded, fireNodeRemoved, getGraphListeners, removeGraphEventListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_netList

protected NetList _netList
Constructor Detail

DefaultGraphModel

public DefaultGraphModel()

DefaultGraphModel

public DefaultGraphModel(NetList nl)
Method Detail

getNetList

public NetList getNetList()

setNetList

public void setNetList(NetList nl)

OK

public boolean OK()

getNodes

public Vector getNodes()
Return all nodes in the graph

getEdges

public Vector getEdges()
Return all nodes in the graph

getPorts

public Vector getPorts(Object nodeOrEdge)
Return all ports on node or edge

getOwner

public Object getOwner(Object port)
Return the node or edge that owns the given port

getInEdges

public Vector getInEdges(Object port)
Return all edges going to given port

getOutEdges

public Vector getOutEdges(Object port)
Return all edges going from given port

getSourcePort

public Object getSourcePort(Object edge)
Return one end of an edge

getDestPort

public Object getDestPort(Object edge)
Return the other end of an edge

canAddNode

public boolean canAddNode(Object node)
Return true if the given object is a valid node in this graph

canAddEdge

public boolean canAddEdge(Object edge)
Return true if the given object is a valid edge in this graph

removeNode

public void removeNode(Object node)
Remove the given node from the graph.

addNode

public void addNode(Object node)
Add the given node to the graph, if valid.

addEdge

public void addEdge(Object edge)
Add the given edge to the graph, if valid.

removeEdge

public void removeEdge(Object edge)
Remove the given edge from the graph.

canConnect

public boolean canConnect(Object srcPort,
                          Object destPort)
Return true if the two given ports can be connected by a kind of edge to be determined by the ports.

canConnect

public boolean canConnect(Object srcPort,
                          Object destPort,
                          Class edgeClass)
Return true if the two given ports can be connected by the given kind of edge.
Overrides:
canConnect in class MutableGraphSupport

connect

public Object connect(Object srcPort,
                      Object destPort)
Contruct and add a new edge of a kind determined by the ports

connect

public Object connect(Object srcPort,
                      Object destPort,
                      Class edgeClass)
Contruct and add a new edge of the given kind
Overrides:
connect in class MutableGraphSupport

connectInternal

protected Object connectInternal(NetPort s,
                                 NetPort d,
                                 NetEdge e)