Package ptolemy.actor

Class RelationWidthInference


  • public class RelationWidthInference
    extends java.lang.Object
    A class that offers convenience utility methods to infer the widths of relations in a composite actor.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Bert Rodiers
    Pt.ProposedRating:
    Red (rodiers)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.util.Set<IORelation> _relationsWithUnspecifiedWidths​(java.util.List<?> relationList)
      Filter the relations for which the width still has to be inferred.
      boolean inferringWidths()
      Determine whether widths are currently being inferred or not.
      void inferWidths()
      Infer the width of the relations for which no width has been specified yet.
      boolean needsWidthInference()
      Return whether the current widths of the relation in the model are no longer valid anymore and the widths need to be inferred again.
      void notifyConnectivityChange()
      Notify the width inference algorithm that the connectivity in the model changed (width of relation changed, relations added, linked to different ports, ...).
      • Methods inherited from class java.lang.Object

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

      • RelationWidthInference

        public RelationWidthInference​(CompositeActor topLevel)
        Create RelationWidthInference, the algorithm for width inference. Also set the top level to the value given as argument.
        Parameters:
        topLevel - The top level CompositeActor.
        Throws:
        java.lang.IllegalArgumentException - If the specified actor is not the top level container. That is, its container is not null.
    • Method Detail

      • inferringWidths

        public boolean inferringWidths()
        Determine whether widths are currently being inferred or not.
        Returns:
        True When widths are currently being inferred.
      • inferWidths

        public void inferWidths()
                         throws IllegalActionException
        Infer the width of the relations for which no width has been specified yet. The specified actor must be the top level container of the model.
        Throws:
        IllegalActionException - If the widths of the relations at port are not consistent or if the width cannot be inferred for a relation.
      • needsWidthInference

        public boolean needsWidthInference()
        Return whether the current widths of the relation in the model are no longer valid anymore and the widths need to be inferred again.
        Returns:
        True when width inference needs to be executed again.
      • notifyConnectivityChange

        public void notifyConnectivityChange()
        Notify the width inference algorithm that the connectivity in the model changed (width of relation changed, relations added, linked to different ports, ...). This will invalidate the current width inference.
      • _relationsWithUnspecifiedWidths

        protected static java.util.Set<IORelation> _relationsWithUnspecifiedWidths​(java.util.List<?> relationList)
                                                                            throws IllegalActionException
        Filter the relations for which the width still has to be inferred.
        Parameters:
        relationList - The relations that need to be filtered.
        Returns:
        The relations for which the width still has to return.
        Throws:
        IllegalActionException - If the expression for the width cannot be parsed or cannot be evaluated, or if the result of evaluation violates type constraints, or if the result of evaluation is null and there are variables that depend on this one.