Package jadex.rules.tools.reteviewer
Class ReteLayout
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.layout.AbstractLayout
-
- jadex.rules.tools.reteviewer.ReteLayout
-
- All Implemented Interfaces:
edu.uci.ics.jung.algorithms.layout.Layout,org.apache.commons.collections15.Transformer
public class ReteLayout extends edu.uci.ics.jung.algorithms.layout.AbstractLayout implements edu.uci.ics.jung.algorithms.layout.LayoutJung layout for a Rete network.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanannealingFlag to enable simulated annealing (SA).protected java.util.ListlayersThe nodes, sorted in layers.protected booleanlayoutFlag to enable layout optimization.protected booleanpositionsFlag to indicate when positions are up-to-date.protected java.awt.DimensionrsizeThe size.
-
Constructor Summary
Constructors Constructor Description ReteLayout(edu.uci.ics.jung.graph.Graph g)Create a new Rete layout.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected doublecalcEdgeLength(ReteEdge edge, INode node, int layer, int pos)Calculate the edge length of the given edge.protected doublecalcEdgeLengths(edu.uci.ics.jung.graph.Graph graph, INode node, int layer, int pos)Calculate the edge lengths between a node and its parents/children.edu.uci.ics.jung.graph.GraphgetGraph()Get the graph to be layouted.java.awt.DimensiongetSize()Get the size.voidgraphChanged()Called, when the graph structure has changed.voidinitialize()Called when a (re-)layout is needed.protected voidlayoutLayers()Called when a (re-)layout is needed.voidreset()Called when ?protected voidsetPositions()Called, when the component has been resized.voidsetSize(java.awt.Dimension size)Called, when the component is resized.-
Methods inherited from class edu.uci.ics.jung.algorithms.layout.AbstractLayout
getX, getY, isLocked, lock, lock, offsetVertex, setGraph, setInitializer, setLocation, setLocation, transform
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
rsize
protected java.awt.Dimension rsize
The size.
-
layers
protected java.util.List layers
The nodes, sorted in layers.
-
positions
protected boolean positions
Flag to indicate when positions are up-to-date.
-
layout
protected boolean layout
Flag to enable layout optimization. With layout optimization, not only edge lengths are optimized, but also left/right directions of connected alpha and beta nodes.
-
annealing
protected boolean annealing
Flag to enable simulated annealing (SA). With SA, the layout algorithm will take longer, but can escape sub optimal local minima.
-
-
Method Detail
-
initialize
public void initialize()
Called when a (re-)layout is needed.- Specified by:
initializein interfaceedu.uci.ics.jung.algorithms.layout.Layout
-
reset
public void reset()
Called when ?- Specified by:
resetin interfaceedu.uci.ics.jung.algorithms.layout.Layout
-
getGraph
public edu.uci.ics.jung.graph.Graph getGraph()
Get the graph to be layouted.- Specified by:
getGraphin interfaceedu.uci.ics.jung.algorithms.layout.Layout- Overrides:
getGraphin classedu.uci.ics.jung.algorithms.layout.AbstractLayout
-
setSize
public void setSize(java.awt.Dimension size)
Called, when the component is resized. New positions will be calculated on next redrawn.- Specified by:
setSizein interfaceedu.uci.ics.jung.algorithms.layout.Layout- Overrides:
setSizein classedu.uci.ics.jung.algorithms.layout.AbstractLayout
-
getSize
public java.awt.Dimension getSize()
Get the size.- Specified by:
getSizein interfaceedu.uci.ics.jung.algorithms.layout.Layout- Overrides:
getSizein classedu.uci.ics.jung.algorithms.layout.AbstractLayout
-
graphChanged
public void graphChanged()
Called, when the graph structure has changed. New layer structure will be calculated on next redraw.
-
layoutLayers
protected void layoutLayers()
Called when a (re-)layout is needed. Arrange node in layers structure (lists of lists of nodes), which is independent of component size.
-
setPositions
protected void setPositions()
Called, when the component has been resized. Use layer structure to place nodes inside component bounds.
-
calcEdgeLengths
protected double calcEdgeLengths(edu.uci.ics.jung.graph.Graph graph, INode node, int layer, int pos)Calculate the edge lengths between a node and its parents/children.
-
-