GoGraph
v1.0


gograph.base.graph
Class GGModel

java.lang.Object
  |
  +--javax.swing.undo.UndoableEditSupport
        |
        +--org.jgraph.graph.DefaultGraphModel
              |
              +--gograph.base.graph.GGModel
All Implemented Interfaces:
org.jgraph.graph.GraphModel, java.io.Serializable

public class GGModel
extends org.jgraph.graph.DefaultGraphModel

A graph model that defines orientation, edge weights, initial vertex for algorithms, getting vertices, edges and neighbours in a particular order and does not allow vertex self-connexion.

See Also:
GoGraph, Serialized Form

Field Summary
 
Fields inherited from class org.jgraph.graph.DefaultGraphModel
asksAllowsChildren, emptyIterator, listenerList, roots
 
Fields inherited from class javax.swing.undo.UndoableEditSupport
compoundEdit, listeners, realSource, updateLevel
 
Constructor Summary
GGModel()
           
 
Method Summary
 boolean acceptsSource(java.lang.Object edge, java.lang.Object port)
          Returns true if port is a valid source for edge.
 boolean acceptsTarget(java.lang.Object edge, java.lang.Object port)
          Returns true if port is a valid target for edge.
 java.lang.Object getEdgeBetween(GGModel model, java.lang.Object vertex1, java.lang.Object vertex2)
          Get the Edge connecting vertex1 to vertex2, if it exists.
 java.lang.Object getInitial()
          Initial vertex getter.
 java.util.Set getNeighbors(GGModel model, java.lang.Object vertex)
          Get the ordered set of neighbor vertices of vertex in model.
 java.util.Set getVertices(GGModel model)
          Get the Set of all vertices in model.
 boolean isOriented()
          Oriented model getter.
 boolean isWeighted()
          Weighted model getter.
 void setInitial(java.lang.Object vertex)
          Initial vertex setter.
 void setOriented(boolean isOriented)
          Oriented model setter.
 void setWeighted(boolean isWeighted)
          Weighted model setter.
 
Methods inherited from class org.jgraph.graph.DefaultGraphModel
addGraphModelListener, cloneCells, connect, contains, createCellEdit, createEdit, createInsertEdit, createLayerEdit, createRemoveEdit, edges, edit, fireGraphChanged, getAttributes, getChild, getChildCount, getDescendantList, getDescendants, getEdges, getGraphModelListeners, getIndexOfChild, getIndexOfRoot, getParent, getRootAt, getRootCount, getRoots, getSource, getSourceVertex, getTarget, getTargetVertex, handleAttributes, handleConnection, handleConnectionSet, handleInsert, handleParentMap, handleRemove, insert, isEdge, isLeaf, isPort, remove, removeGraphModelListener, toBack, toFront
 
Methods inherited from class javax.swing.undo.UndoableEditSupport
_postEdit, addUndoableEditListener, beginUpdate, createCompoundEdit, endUpdate, getUndoableEditListeners, getUpdateLevel, postEdit, removeUndoableEditListener, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jgraph.graph.GraphModel
addUndoableEditListener, removeUndoableEditListener
 

Constructor Detail

GGModel

public GGModel()
Method Detail

setInitial

public void setInitial(java.lang.Object vertex)
Initial vertex setter.

Parameters:
vertex - Initial vertex.

setOriented

public void setOriented(boolean isOriented)
Oriented model setter.

Parameters:
isOriented - Oriented property boolean.

setWeighted

public void setWeighted(boolean isWeighted)
Weighted model setter.

Parameters:
isWeighted - Weighted property boolean.

getInitial

public java.lang.Object getInitial()
Initial vertex getter.

Returns:
Initial vertex.

isOriented

public boolean isOriented()
Oriented model getter.

Returns:
Oriented property boolean.

isWeighted

public boolean isWeighted()
Weighted model getter.

Returns:
Weighted property boolean.

acceptsSource

public boolean acceptsSource(java.lang.Object edge,
                             java.lang.Object port)
Returns true if port is a valid source for edge.

Specified by:
acceptsSource in interface org.jgraph.graph.GraphModel
Overrides:
acceptsSource in class org.jgraph.graph.DefaultGraphModel
Parameters:
edge - Edge being tested.
port - Port being tested.
Returns:
true if port is a valid source for edge, false otherwise.

acceptsTarget

public boolean acceptsTarget(java.lang.Object edge,
                             java.lang.Object port)
Returns true if port is a valid target for edge.

Specified by:
acceptsTarget in interface org.jgraph.graph.GraphModel
Overrides:
acceptsTarget in class org.jgraph.graph.DefaultGraphModel
Parameters:
edge - Edge being tested.
port - Port being tested.
Returns:
true if port is a valid target for edge, false otherwise.

getNeighbors

public java.util.Set getNeighbors(GGModel model,
                                  java.lang.Object vertex)
Get the ordered set of neighbor vertices of vertex in model.

Parameters:
model - Graph data model.
vertex - Vertex from which to return neighbors.
Returns:
Ordered set of neighbor vertices of vertex.

getVertices

public java.util.Set getVertices(GGModel model)
Get the Set of all vertices in model.

Parameters:
model - Graph data model.
Returns:
Set of all vertices in model.

getEdgeBetween

public java.lang.Object getEdgeBetween(GGModel model,
                                       java.lang.Object vertex1,
                                       java.lang.Object vertex2)
Get the Edge connecting vertex1 to vertex2, if it exists.

Parameters:
model - Graph data model.
vertex1 - A vertex from model.
vertex2 - A vertex from model.
Returns:
Edge connecting vertex1 to vertex2, or null if it doesn't exist.

GoGraph
v1.0


Copyright (C) 2003 Stewe Frei. All rights reserved.