Class KielerGraphUtil


  • public final class KielerGraphUtil
    extends java.lang.Object
    Static helper class to work with KIELER graph datas structures.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Hauke Fuhrmann (haf)
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Constructor Summary

      Constructors 
      Constructor Description
      KielerGraphUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static de.cau.cs.kieler.core.kgraph.KNode _getParent​(de.cau.cs.kieler.core.kgraph.KEdge edge)
      Get the parent node of an KIELER KEdge.
      protected static de.cau.cs.kieler.core.math.KVector _getUpperLeftCorner​(de.cau.cs.kieler.core.kgraph.KNode parent)
      Get the upper left corner of the real bounding box of the contents of a given KIELER node.
      protected static java.awt.geom.Point2D _shrinkCoordinates​(java.awt.geom.Rectangle2D originalBounds, java.awt.geom.Rectangle2D shrunkBounds, int direction, float offset)
      Reposition a small object in a big object according to a given direction (NORTH, EAST, SOUTH, WEST).
      protected static java.lang.String _toString​(de.cau.cs.kieler.core.kgraph.KEdge edge)
      Debug output a KEdge to a String, i.e.
      protected static java.lang.String _toString​(de.cau.cs.kieler.core.kgraph.KNode knode)
      Debug output a KNode to a String, i.e.
      protected static java.lang.String _toString​(de.cau.cs.kieler.core.kgraph.KNode knode, int level)
      Debug output a KNode to a String, i.e.
      protected static void _writeToFile​(de.cau.cs.kieler.core.kgraph.KNode kgraph)
      Write a KGraph (KIELER graph data structure) to a file in its XMI representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KielerGraphUtil

        public KielerGraphUtil()
    • Method Detail

      • _getParent

        protected static de.cau.cs.kieler.core.kgraph.KNode _getParent​(de.cau.cs.kieler.core.kgraph.KEdge edge)
        Get the parent node of an KIELER KEdge. That is the KIELER KNode that graphically contains the edge. In particular that is the parent node of the source node of the edge. If the source node is null, then the result is also null.
        Parameters:
        edge - The KIELER edge to determine the parent node.
        Returns:
        The parent KIELER node of the given edge or null if the source of the edge is undefined.
      • _getUpperLeftCorner

        protected static de.cau.cs.kieler.core.math.KVector _getUpperLeftCorner​(de.cau.cs.kieler.core.kgraph.KNode parent)
        Get the upper left corner of the real bounding box of the contents of a given KIELER node. Calculate the minimal x and y coordinates of all nodes contained in the given node.
        Parameters:
        parent - The composite KIELER node that contains other nodes.
        Returns:
        The minimal x and y coordinates of all contained nodes. Might be Float.MAX_VALUE, if the parent does not contain any children.
      • _shrinkCoordinates

        protected static java.awt.geom.Point2D _shrinkCoordinates​(java.awt.geom.Rectangle2D originalBounds,
                                                                  java.awt.geom.Rectangle2D shrunkBounds,
                                                                  int direction,
                                                                  float offset)
        Reposition a small object in a big object according to a given direction (NORTH, EAST, SOUTH, WEST). The small object will be aligned to the big object's direction side and centered on the other coordinate.
        Parameters:
        originalBounds - Big object's bounds
        shrunkBounds - Small object's bounds
        direction - Direction of the small object within the big object given by a SwingConstants direction constant
        offset - Offset of the lower bound of the port
        Returns:
        New location of the small object.
      • _toString

        protected static java.lang.String _toString​(de.cau.cs.kieler.core.kgraph.KEdge edge)
        Debug output a KEdge to a String, i.e. will represent all bend points in the String.
        Parameters:
        edge - The edge to be toStringed
        Returns:
        A String representing the KEdge
      • _toString

        protected static java.lang.String _toString​(de.cau.cs.kieler.core.kgraph.KNode knode)
        Debug output a KNode to a String, i.e. will represent the whole subgraph starting with this node recursively and also present all outgoing edges of all nodes.
        Parameters:
        knode - The node to be toStringed
        Returns:
        A String representing the KNode
      • _toString

        protected static java.lang.String _toString​(de.cau.cs.kieler.core.kgraph.KNode knode,
                                                    int level)
        Debug output a KNode to a String, i.e. will represent the whole subgraph starting with this node recursively and also present all outgoing edges of all nodes.
        Parameters:
        knode - The node to be toStringed
        level - Tree level of the currently processed element. Used for recursive operation.
        Returns:
        A String representing the KNode
      • _writeToFile

        protected static void _writeToFile​(de.cau.cs.kieler.core.kgraph.KNode kgraph)
        Write a KGraph (KIELER graph data structure) to a file in its XMI representation. Can be used for debugging (manually look at it) or loading it elsewhere, e.g. a KIELER Graph viewer. The default filename is kgraph.xmi and will be written to the current working directory.
        Parameters:
        kgraph - The KIELER graph data structure given by its root KNode.