Class SourceNodeStrategy

  • All Implemented Interfaces:
    Analyzer, GraphAnalyzer, SourceNodeAnalyzer

    public class SourceNodeStrategy
    extends CachedStrategy
    implements SourceNodeAnalyzer
    Computation of source 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:
    SourceNodeAnalysis
    Pt.AcceptedRating:
    Red (ssb)
    Pt.ProposedRating:
    Red (shahrooz)
    • Constructor Detail

      • SourceNodeStrategy

        public SourceNodeStrategy​(Graph graph)
        Construct an instance of this strategy for a given graph.
        Parameters:
        graph - The given graph.
    • Method Detail

      • nodes

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

        public java.lang.String toString()
        Return a description of the analyzer.
        Specified by:
        toString in interface Analyzer
        Overrides:
        toString in class CachedStrategy
        Returns:
        Return a description of the analyzer..
      • 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 source 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 source nodes.
      • _convertResult

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