Class PtolemyModelUtil


  • public final class PtolemyModelUtil
    extends java.lang.Object
    Utility class for accessing properties of a Ptolemy model in the context of automatic layout. The methods are used by the KIELER layout bridge that integrates KIELER layout algorithms into Ptolemy.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Hauke Fuhrmann (haf), Christian Motika (cmot), Miro Spoenemann (msp), Ulf Rueegg
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static int _getExternalPortDirection​(Port port)
      Get the direction of the edge anchor point of an external port inside a composite actor.
      protected static NamedObj _getReferencedObj​(RelativeLocation location)
      Find the reference object for the given relative location.
      protected static java.util.Set<java.util.List<Relation>> _getRelationGroups​(java.util.Set<Relation> relations)
      For a set of relations get a set of relation groups, i.e.
      protected static boolean _isConnected​(NamedObj namedObj)
      Check whether the given Ptolemy model object has any connections, i.e.
      protected static boolean _isFinalState​(State state)
      Return true if the state is a final state.
      protected static boolean _isInitialState​(State state)
      Return true if the state is an initial state.
      protected static boolean _isInput​(Port port)
      Determine whether a given Port is an input port.
      • Methods inherited from class java.lang.Object

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

      • PtolemyModelUtil

        public PtolemyModelUtil()
    • Method Detail

      • _getRelationGroups

        protected static java.util.Set<java.util.List<Relation>> _getRelationGroups​(java.util.Set<Relation> relations)
        For a set of relations get a set of relation groups, i.e. for each relation construct a list of relations that are all interconnected, either directly or indirectly.
        Parameters:
        relations - Set of relations
        Returns:
        a Set of relation groups as given by List <Relation> objects by Ptolemy
      • _isConnected

        protected static boolean _isConnected​(NamedObj namedObj)
        Check whether the given Ptolemy model object has any connections, i.e. is connected to any other components via some link.
        Parameters:
        namedObj - The Ptolemy model object which is to be analyzed
        Returns:
        True if the object is an Actor and any port has any relations or is connected to any other port; true if the object is a Relation; false if the object is an Attribute. Defaults to false.
      • _getReferencedObj

        protected static NamedObj _getReferencedObj​(RelativeLocation location)
        Find the reference object for the given relative location.
        Parameters:
        location - A relative location
        Returns:
        The corresponding reference object, or null if there is none
      • _isInput

        protected static boolean _isInput​(Port port)
        Determine whether a given Port is an input port.
        Parameters:
        port - The port to be analyzed
        Returns:
        True if the port is an input port
      • _getExternalPortDirection

        protected static int _getExternalPortDirection​(Port port)
        Get the direction of the edge anchor point of an external port inside a composite actor. It is given as a SwingConstants, like SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST, SwingConstants.WEST.
        Parameters:
        port - the external port
        Returns:
        a SwingConstant about the direction
      • _isInitialState

        protected static boolean _isInitialState​(State state)
        Return true if the state is an initial state.
        Parameters:
        state - a State to test
        Returns:
        whether the passed state has the isInitialState parameter set to true.
      • _isFinalState

        protected static boolean _isFinalState​(State state)
        Return true if the state is a final state.
        Parameters:
        state - a State to test
        Returns:
        whether the passed state has the isFinalState parameter set to true.