net.xqhs.graphs.representation
Interface GraphRepresentation

All Known Implementing Classes:
GraphicalGraphRepresentation, GraphRepresentationImplementation, LinearGraphRepresentation, MultilevelGraphRepresentation, RadialGraphRepresentation, TextGraphRepresentation, TextMultilevelGraphRepresentation

public interface GraphRepresentation

This is the interface that should be implemented by any class offering a representation for a Graph instance.

A representation is supposed to be associated with the same Graph instance throughout its entire lifetime. This is why the associated Graph instance should be set in the constructor of the GraphRepresentation instance.

It is possible to use an instance of this interface also in a tree of representations, in which each representation has a parent.

The representation is based on RepresentationElement instances, each being usually assigned to a graph element (instance of VisualizableGraphComponent). The elements of the representation are linked so that they form a tree, rooted by the element returned by getRepresentation.

Author:
Andrei Olaru

Method Summary
 java.lang.Object displayRepresentation()
          Depending on the nature of the representation, this method returns a way to visualize the representation.
 RepresentationElement getRepresentation()
          Gets the root element of the representation.
 GraphRepresentation getRootRepresentation()
          Gets the root representation of the tree of representation this instance is part of.
 GraphRepresentation setParentRepresentation(GraphRepresentation parent)
          Set the parent representation in a multi-level graph representation.
 GraphRepresentation update()
          Instructs the representation to update, since some elements of the graph may have changed.
 

Method Detail

update

GraphRepresentation update()
Instructs the representation to update, since some elements of the graph may have changed.

FIXME: this is inefficient as it will cause the whole representation to update - there is no indication on what part of the graph has changed.

Returns:
the instance itself.

setParentRepresentation

GraphRepresentation setParentRepresentation(GraphRepresentation parent)
Set the parent representation in a multi-level graph representation.

The argument may be null, to indicate this representation does not belong to a larger one, or is the root of a larger representation.

Parameters:
parent - : the parent representation.
Returns:
the instance itself.

getRootRepresentation

GraphRepresentation getRootRepresentation()
Gets the root representation of the tree of representation this instance is part of. The result may be the instance itself, if there is no higher-level representation.

Returns:
the root GraphRepresentation.

getRepresentation

RepresentationElement getRepresentation()
Gets the root element of the representation.

Returns:
the root RepresentationElement instance.

displayRepresentation

java.lang.Object displayRepresentation()
Depending on the nature of the representation, this method returns a way to visualize the representation. For instance, for textual representations, the returned value is of type String.

Returns:
the representation of the graph.