Class Fixpoint<G extends Graph<G,​N,​E>,​N extends Node<G,​N,​E>,​E extends Edge<G,​N,​E>,​T>

  • Type Parameters:
    G - the type of the source Graph
    N - the type of the Nodes in the source graph
    E - the type of the Edges in the source graph
    T - the type of data computed by the fixpoint
    Direct Known Subclasses:
    OptimizedFixpoint

    public class Fixpoint<G extends Graph<G,​N,​E>,​N extends Node<G,​N,​E>,​E extends Edge<G,​N,​E>,​T>
    extends java.lang.Object
    A fixpoint algorithm for a Graph, parametric to the Fixpoint.FixpointImplementation that one wants to use to compute the results.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Fixpoint.FixpointImplementation<N,​E,​T>
      Concrete implementation of the general methods used by a fixpoint algorithm to perform.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String ERROR
      Common format for error messages.
      protected boolean forceFullEvaluation
      Whether or not all nodes should be processed at least once.
      protected G graph
      The graph to target.
    • Constructor Summary

      Constructors 
      Constructor Description
      Fixpoint​(G graph, boolean forceFullEvaluation)
      Builds a fixpoint for the given Graph.
    • Field Detail

      • ERROR

        protected static final java.lang.String ERROR
        Common format for error messages.
        See Also:
        Constant Field Values
      • graph

        protected final G extends Graph<G,​N,​E> graph
        The graph to target.
      • forceFullEvaluation

        protected final boolean forceFullEvaluation
        Whether or not all nodes should be processed at least once.
    • Constructor Detail

      • Fixpoint

        public Fixpoint​(G graph,
                        boolean forceFullEvaluation)
        Builds a fixpoint for the given Graph.
        Parameters:
        graph - the source graph
        forceFullEvaluation - whether or not the fixpoint should evaluate all nodes independently of the fixpoint implementation
    • Method Detail

      • fixpoint

        public java.util.Map<N,​T> fixpoint​(java.util.Map<N,​T> startingPoints,
                                                 WorkingSet<N> ws,
                                                 Fixpoint.FixpointImplementation<N,​E,​T> implementation)
                                          throws FixpointException
        Runs the fixpoint. Invoking this method effectively recomputes the result: no caching on previous runs is executed. It starts with empty result.
        Parameters:
        startingPoints - a map containing all the nodes to start the fixpoint at, each mapped to its entry state.
        ws - the instance of WorkingSet to use for the fixpoint
        implementation - the Fixpoint.FixpointImplementation to use for running the fixpoint
        Returns:
        a mapping from each (reachable) node of the source graph to the fixpoint result computed at that node
        Throws:
        FixpointException - if something goes wrong during the fixpoint execution
      • fixpoint

        public java.util.Map<N,​T> fixpoint​(java.util.Map<N,​T> startingPoints,
                                                 WorkingSet<N> ws,
                                                 Fixpoint.FixpointImplementation<N,​E,​T> implementation,
                                                 java.util.Map<N,​T> initialResult)
                                          throws FixpointException
        Runs the fixpoint. Invoking this method effectively recomputes the result: no caching on previous runs is executed.
        Parameters:
        startingPoints - a map containing all the nodes to start the fixpoint at, each mapped to its entry state.
        ws - the instance of WorkingSet to use for the fixpoint
        implementation - the Fixpoint.FixpointImplementation to use for running the fixpoint
        initialResult - the map of initial result to use for running the fixpoint
        Returns:
        a mapping from each (reachable) node of the source graph to the fixpoint result computed at that node
        Throws:
        FixpointException - if something goes wrong during the fixpoint execution
      • getEntryState

        protected T getEntryState​(N node,
                                  T startstate,
                                  Fixpoint.FixpointImplementation<N,​E,​T> implementation,
                                  java.util.Map<N,​T> result)
                           throws FixpointException
        Yields the entry state for the given node.
        Parameters:
        node - the node under evaluation
        startstate - a predefined starting state that must be taken into account for the computation
        implementation - the fixpoint implementation that knows how to combine different states
        result - the current approximations for each node
        Returns:
        the computed state
        Throws:
        FixpointException - if something goes wrong during the computation