net.sourceforge.gxl
Class GXLGraph

java.lang.Object
  |
  +--net.sourceforge.gxl.GXLElement
        |
        +--net.sourceforge.gxl.GXLAttributedElement
              |
              +--net.sourceforge.gxl.GXLTypedElement
                    |
                    +--net.sourceforge.gxl.GXLGraph

public class GXLGraph
extends GXLTypedElement

Represents the GXL graph element.

The graph element represents a graph containing graph elements.

Children
GXLType - see GXLType.
GXLAttr - Attributes describing this graph.
GXLNode - Nodes contained in this graph.
GXLEdge - Edges contained in this graph.
GXLRel - Relations contained in this graph.

Attributes
id - Required id of this graph element.
role - Optional string describing the function of this graph.
edgeids - Optional boolean, describes whether this graphs edges and relations contains ids. Due to ambiguos use by applications, this value is not enforced by this package. Defaults to false.
hypergraph - Optional boolean, describes whether this graph may contain rel elements. Defaults to false.
edgemode - Optional enumeration defining the direction of edges and relations contained in this graph. Possible values are directed, undirected, defaultdirected and defaultundirected. The defaultX values implies that the direction can be overridden by individual edges and relations using the directed attribute.

See Also:
GXLGraphElement

Constructor Summary
GXLGraph(String id)
          Creates a new GXLGraph element with the specified id.
 
Method Summary
 boolean getAllowsHyperGraphs()
          Returns the value of the hypergraph attribute.
 boolean getEdgeIDs()
          Returns the value of the edgeids attribute.
 String getEdgeMode()
          Returns the value of the edgemode attribute.
 GXLGraphElement getGraphElementAt(int i)
          Returns the specified GXLGraphElement.
 int getGraphElementCount()
          Returns the number of GXLGraphElements (nodes, edges and relations) contained in this graph.
 String getRole()
          Returns the value of the role attribute or null if the attribute isn't set.
 void setAllowsHyperGraphs(boolean hypergraph)
          Sets the value of the hypergraph attribute.
 void setEdgeIDs(boolean edgeids)
          Sets the value of the edgeids attribute.
 void setEdgeMode(String edgemode)
          Sets the value of the edgemode attribute.
 void setRole(String role)
          Sets the value of the role attribute.
 
Methods inherited from class net.sourceforge.gxl.GXLTypedElement
getType, setType
 
Methods inherited from class net.sourceforge.gxl.GXLAttributedElement
getAttr, getAttrAt, getAttrCount, getID, setAttr, setID
 
Methods inherited from class net.sourceforge.gxl.GXLElement
add, getAttribute, getChildAt, getChildCount, getDocument, getParent, indexOf, insert, remove, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GXLGraph

public GXLGraph(String id)
Creates a new GXLGraph element with the specified id.

Parameters:
id - The id of the new graph element.
Method Detail

getGraphElementCount

public int getGraphElementCount()
Returns the number of GXLGraphElements (nodes, edges and relations) contained in this graph.

Returns:
The number of GXLGraphElements (nodes, edges and relations) contained in this graph.
See Also:
GXLElement.getChildCount()

getGraphElementAt

public GXLGraphElement getGraphElementAt(int i)
Returns the specified GXLGraphElement.

Parameters:
i - The index of the specified GXLGraphElement.
Returns:
The specified GXLGraphElement.
See Also:
GXLElement.getChildAt(int i)

getRole

public String getRole()
Returns the value of the role attribute or null if the attribute isn't set. This simply calls getAttribute(GXL.ROLE).

Returns:
The value of the role attribute.
See Also:
GXLElement.getAttribute(String)

setRole

public void setRole(String role)
Sets the value of the role attribute. This simply calls setAttribute(GXL.ROLE, role).

Parameters:
role - The new value.
See Also:
GXLElement.setAttribute(String, String)

getEdgeIDs

public boolean getEdgeIDs()
Returns the value of the edgeids attribute. This simply calls GXL.TRUE.equals(getAttribute(GXL.EDGEIDS)).

Returns:
The value of the edgeids attribute.
See Also:
GXLElement.getAttribute(String)

setEdgeIDs

public void setEdgeIDs(boolean edgeids)
Sets the value of the edgeids attribute. This simply calls setAttribute(GXL.EDGEIDS, edgeids ? GXL.TRUE : GXL.FALSE).

Parameters:
edgeids - The new value.
See Also:
GXLElement.setAttribute(String, String)

getAllowsHyperGraphs

public boolean getAllowsHyperGraphs()
Returns the value of the hypergraph attribute. This simply calls GXL.TRUE.equals(getAttribute(GXL.HYPERGRAPH)).

Returns:
The value of the hypergraph attribute.
See Also:
GXLElement.getAttribute(String)

setAllowsHyperGraphs

public void setAllowsHyperGraphs(boolean hypergraph)
Sets the value of the hypergraph attribute. This simply calls setAttribute(GXL.HYPERGRAPH, hypergraph ? GXL.TRUE : GXL.FALSE).

Parameters:
hypergraph - The new value.
Throws:
GXLValidationException - If this action would result in an invalid GXL document.
See Also:
GXLElement.setAttribute(String, String)

getEdgeMode

public String getEdgeMode()
Returns the value of the edgemode attribute. This simply calls getAttribute(GXL.EDGEMODE).

Returns:
The value of the edgemode attribute.
See Also:
GXLElement.getAttribute(String)

setEdgeMode

public void setEdgeMode(String edgemode)
Sets the value of the edgemode attribute. This simply calls setAttribute(GXL.EDGEMODE, edgemode).

Parameters:
edgemode - The new value.
Throws:
GXLValidationException - If this action would result in an invalid GXL document.
See Also:
GXLElement.setAttribute(String, String)