Class 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.Layout
    Jung layout for a Rete network.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean annealing
      Flag to enable simulated annealing (SA).
      protected java.util.List layers
      The nodes, sorted in layers.
      protected boolean layout
      Flag to enable layout optimization.
      protected boolean positions
      Flag to indicate when positions are up-to-date.
      protected java.awt.Dimension rsize
      The size.
      • Fields inherited from class edu.uci.ics.jung.algorithms.layout.AbstractLayout

        graph, initialized, locations, 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 double calcEdgeLength​(ReteEdge edge, INode node, int layer, int pos)
      Calculate the edge length of the given edge.
      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.
      edu.uci.ics.jung.graph.Graph getGraph()
      Get the graph to be layouted.
      java.awt.Dimension getSize()
      Get the size.
      void graphChanged()
      Called, when the graph structure has changed.
      void initialize()
      Called when a (re-)layout is needed.
      protected void layoutLayers()
      Called when a (re-)layout is needed.
      void reset()
      Called when ?
      protected void setPositions()
      Called, when the component has been resized.
      void setSize​(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
      • Methods inherited from interface edu.uci.ics.jung.algorithms.layout.Layout

        isLocked, lock, setGraph, setInitializer, setLocation
      • Methods inherited from interface org.apache.commons.collections15.Transformer

        transform
    • 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.
    • Constructor Detail

      • ReteLayout

        public ReteLayout​(edu.uci.ics.jung.graph.Graph g)
        Create a new Rete layout.
    • Method Detail

      • initialize

        public void initialize()
        Called when a (re-)layout is needed.
        Specified by:
        initialize in interface edu.uci.ics.jung.algorithms.layout.Layout
      • reset

        public void reset()
        Called when ?
        Specified by:
        reset in interface edu.uci.ics.jung.algorithms.layout.Layout
      • getGraph

        public edu.uci.ics.jung.graph.Graph getGraph()
        Get the graph to be layouted.
        Specified by:
        getGraph in interface edu.uci.ics.jung.algorithms.layout.Layout
        Overrides:
        getGraph in class edu.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:
        setSize in interface edu.uci.ics.jung.algorithms.layout.Layout
        Overrides:
        setSize in class edu.uci.ics.jung.algorithms.layout.AbstractLayout
      • getSize

        public java.awt.Dimension getSize()
        Get the size.
        Specified by:
        getSize in interface edu.uci.ics.jung.algorithms.layout.Layout
        Overrides:
        getSize in class edu.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.
      • calcEdgeLength

        protected double calcEdgeLength​(ReteEdge edge,
                                        INode node,
                                        int layer,
                                        int pos)
        Calculate the edge length of the given edge. If layout is enabled, the edge length is rated according to layout constraints (shorter length = better layout).