Class SinkNodeStrategy

  • All Implemented Interfaces:
    Analyzer, GraphAnalyzer, SinkNodeAnalyzer

    public class SinkNodeStrategy
    extends CachedStrategy
    implements SinkNodeAnalyzer
    Computation of sink nodes in a graph. The collection returned cannot be modified.

    This analysis requires O(N) time, where N is the number of nodes in the graph.

    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    Ming Yung Ko, Shahrooz Shahparnia
    See Also:
    SinkNodeAnalysis
    Pt.AcceptedRating:
    Red (ssb)
    Pt.ProposedRating:
    Red (ssb)
    • Constructor Detail

      • SinkNodeStrategy

        public SinkNodeStrategy​(Graph graph)
        Construct a sink node analysis for a given graph.
        Parameters:
        graph - The given graph.
    • Method Detail

      • nodes

        public java.util.List nodes()
        Compute the sink nodes in the graph in the form of a collection. Each element of the collection is a Node.
        Specified by:
        nodes in interface SinkNodeAnalyzer
        Returns:
        The sink nodes.
      • toString

        public java.lang.String toString()
        Return a description of sink nodes.
        Specified by:
        toString in interface Analyzer
        Overrides:
        toString in class CachedStrategy
        Returns:
        A description of the sink nodes.
      • valid

        public boolean valid()
        Check compatibility of the class of graph. The given graph must be an instance of DirectedGraph.
        Specified by:
        valid in interface Analyzer
        Returns:
        True if the given graph is of class DirectedGraph.
      • _compute

        protected java.lang.Object _compute()
        Compute the sink nodes in the graph in the form of a collection. Each element of the collection is a Node.
        Overrides:
        _compute in class CachedStrategy
        Returns:
        The sink nodes.
      • _convertResult

        protected java.lang.Object _convertResult()
        Return the result of this analysis (collection of sink nodes) in a form that cannot be modified.
        Returns:
        The analysis result in unmodifiable form.