Class IndexEventTracker

  • All Implemented Interfaces:
    ca.uqac.lif.cep.EventTracker

    public class IndexEventTracker
    extends java.lang.Object
    implements ca.uqac.lif.cep.EventTracker
    Tracks the relationship between output events produced by processors, and the input events that were used to compute them. This tracker only keeps track of the IDs of the processors, and the relative position of events in their respective input and output streams. It does not keep the processors or the events themselves. Therefore, its output is only a "skeleton" of the dependencies between events, that can then be used to compute other dependency graphs by other event trackers.
    Author:
    Sylvain Hallé
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  IndexEventTracker.ProcessorConnection  
      • Nested classes/interfaces inherited from interface ca.uqac.lif.cep.EventTracker

        ca.uqac.lif.cep.EventTracker.NoOpEventTracker
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.Integer,​ca.uqac.lif.cep.GroupProcessor> m_groups  
      protected java.util.Map<java.lang.Integer,​java.util.Map<java.lang.Integer,​IndexEventTracker.ProcessorConnection>> m_inputConnections  
      protected java.util.Map<java.lang.Integer,​java.util.Map<java.lang.Integer,​java.util.Map<java.lang.Integer,​ca.uqac.lif.petitpoucet.ProvenanceNode>>> m_mapping
      A map containing all the input-output associations recorded so far.
      protected java.util.Map<java.lang.Integer,​java.util.Map<java.lang.Integer,​IndexEventTracker.ProcessorConnection>> m_outputConnections  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(ca.uqac.lif.cep.GroupProcessor g)  
      void associateTo​(int id, ca.uqac.lif.petitpoucet.NodeFunction f, int out_stream_index, int out_stream_pos)  
      void associateToInput​(int id, int in_stream_index, int in_stream_pos, int out_stream_index, int out_stream_pos)  
      void associateToOutput​(int id, int in_stream_index, int in_stream_pos, int out_stream_index, int out_stream_pos)  
      protected ca.uqac.lif.petitpoucet.ProvenanceNode expandInputs​(ca.uqac.lif.petitpoucet.ProvenanceNode node, int proc_id)  
      protected ca.uqac.lif.petitpoucet.ProvenanceNode fetchOrCreateProvenanceNode​(int proc_id, int stream_index, int stream_pos)
      Fetches the ProvenanceNode for a given processor/index/position triplet.
      protected ca.uqac.lif.petitpoucet.ProvenanceNode fetchProvenanceNode​(int proc_id, int stream_index, int stream_pos)
      Fetches the ProvenanceNode for a given processor/index/position triplet.
      protected IndexEventTracker.ProcessorConnection getConnection​(java.util.Map<java.lang.Integer,​java.util.Map<java.lang.Integer,​IndexEventTracker.ProcessorConnection>> map, int source_proc_id, int stream_index)  
      ca.uqac.lif.cep.EventTracker getCopy​(boolean with_state)  
      ca.uqac.lif.petitpoucet.ProvenanceNode getImpactTree​(int proc_id, int stream_index, int stream_pos)
      Gets the impact tree for a given event.
      ca.uqac.lif.petitpoucet.ProvenanceNode getProvenanceTree​(int proc_id, int stream_index, int stream_pos)
      Gets the provenance tree for a given event.
      ca.uqac.lif.petitpoucet.ProvenanceNode getProvenanceTree​(ca.uqac.lif.cep.Processor p, int stream_index, int stream_pos)
      Gets the provenance tree for a given event.
      int getSize()
      Returns the size of this tracker.
      void setConnection​(int output_proc_id, int output_stream_index, int input_proc_id, int input_stream_index)  
      protected void setConnection​(java.util.Map<java.lang.Integer,​java.util.Map<java.lang.Integer,​IndexEventTracker.ProcessorConnection>> map, int source_proc_id, int stream_index, IndexEventTracker.ProcessorConnection connection)  
      void setTo​(ca.uqac.lif.cep.Processor... processors)  
      • Methods inherited from class java.lang.Object

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

      • m_mapping

        protected final java.util.Map<java.lang.Integer,​java.util.Map<java.lang.Integer,​java.util.Map<java.lang.Integer,​ca.uqac.lif.petitpoucet.ProvenanceNode>>> m_mapping
        A map containing all the input-output associations recorded so far. This map is a three-tiered nested data structure:
        • At the first level, it associates processor IDs to maps
        • The resulting object is itself a map that associates stream indices for this processor to a map
        • The resulting object is a map that associates positions in that stream to a ProvenanceNode
        The structure could have been a simple set of ProvenanceNodes. However, if we know the processor ID, the stream index and the stream position, finding the corresponding node requires three hash lookups in the present structure, instead of a linear search through an unordered set (or list).
      • m_groups

        protected final java.util.Map<java.lang.Integer,​ca.uqac.lif.cep.GroupProcessor> m_groups
    • Constructor Detail

      • IndexEventTracker

        public IndexEventTracker()
    • Method Detail

      • add

        public void add​(ca.uqac.lif.cep.GroupProcessor g)
        Specified by:
        add in interface ca.uqac.lif.cep.EventTracker
      • associateTo

        public void associateTo​(int id,
                                ca.uqac.lif.petitpoucet.NodeFunction f,
                                int out_stream_index,
                                int out_stream_pos)
        Specified by:
        associateTo in interface ca.uqac.lif.cep.EventTracker
      • associateToInput

        public void associateToInput​(int id,
                                     int in_stream_index,
                                     int in_stream_pos,
                                     int out_stream_index,
                                     int out_stream_pos)
        Specified by:
        associateToInput in interface ca.uqac.lif.cep.EventTracker
      • associateToOutput

        public void associateToOutput​(int id,
                                      int in_stream_index,
                                      int in_stream_pos,
                                      int out_stream_index,
                                      int out_stream_pos)
        Specified by:
        associateToOutput in interface ca.uqac.lif.cep.EventTracker
      • setTo

        public void setTo​(ca.uqac.lif.cep.Processor... processors)
        Specified by:
        setTo in interface ca.uqac.lif.cep.EventTracker
      • fetchOrCreateProvenanceNode

        protected ca.uqac.lif.petitpoucet.ProvenanceNode fetchOrCreateProvenanceNode​(int proc_id,
                                                                                     int stream_index,
                                                                                     int stream_pos)
        Fetches the ProvenanceNode for a given processor/index/position triplet. Since these nodes are stored in a bunch of nested hash maps, and that the maps for the desired keys may have not been initialized yet, the method takes care of creating empty maps as it drills down its way to the node it is looking for.
        Parameters:
        proc_id - The ID of the processor
        stream_index - The index of the output stream on that processor
        stream_pos - The position of the event in that stream
        Returns:
        The provenance node corresponding to that particular event
        See Also:
        m_mapping
      • fetchProvenanceNode

        protected ca.uqac.lif.petitpoucet.ProvenanceNode fetchProvenanceNode​(int proc_id,
                                                                             int stream_index,
                                                                             int stream_pos)
        Fetches the ProvenanceNode for a given processor/index/position triplet. Contrast this to fetchOrCreateProvenanceNode().
        Parameters:
        proc_id - The ID of the processor
        stream_index - The index of the output stream on that processor
        stream_pos - The position of the event in that stream
        Returns:
        The provenance node corresponding to that particular event, or null if no node exists for the specified parameters
      • getProvenanceTree

        public ca.uqac.lif.petitpoucet.ProvenanceNode getProvenanceTree​(ca.uqac.lif.cep.Processor p,
                                                                        int stream_index,
                                                                        int stream_pos)
        Gets the provenance tree for a given event.
        Parameters:
        p - The processor
        stream_index - The index of the stream
        stream_pos - The position of the event in the stream
        Returns:
        The provenance node corresponding to that particular event, or null if no node exists for the specified parameters
      • getProvenanceTree

        public ca.uqac.lif.petitpoucet.ProvenanceNode getProvenanceTree​(int proc_id,
                                                                        int stream_index,
                                                                        int stream_pos)
        Gets the provenance tree for a given event. The provenance tree is the directed acyclic graph of all the provenance nodes on which the current node depends. It is the reverse of the impact tree.
        Specified by:
        getProvenanceTree in interface ca.uqac.lif.cep.EventTracker
        Parameters:
        proc_id - The ID of the processor
        stream_index - The index of the output stream on that processor
        stream_pos - The position of the event in that stream
        Returns:
        The provenance node corresponding to that particular event, or null if no node exists for the specified parameters
        See Also:
        getImpactTree(int, int, int)
      • expandInputs

        protected ca.uqac.lif.petitpoucet.ProvenanceNode expandInputs​(ca.uqac.lif.petitpoucet.ProvenanceNode node,
                                                                      int proc_id)
      • getImpactTree

        public ca.uqac.lif.petitpoucet.ProvenanceNode getImpactTree​(int proc_id,
                                                                    int stream_index,
                                                                    int stream_pos)
        Gets the impact tree for a given event. The impact tree is the directed acyclic graph of all the downstream provenance nodes that depend on the given node.
        Parameters:
        proc_id - The ID of the processor
        stream_index - The index of the output stream on that processor
        stream_pos - The position of the event in that stream
        Returns:
        The provenance node corresponding to that particular event, or null if no node exists for the specified parameters
        See Also:
        getProvenanceTree(int, int, int)
      • setConnection

        public void setConnection​(int output_proc_id,
                                  int output_stream_index,
                                  int input_proc_id,
                                  int input_stream_index)
        Specified by:
        setConnection in interface ca.uqac.lif.cep.EventTracker
      • getSize

        public int getSize()
        Returns the size of this tracker. This corresponds to the number of unique input-output associations that are stored.
        Returns:
        The size
      • getCopy

        public ca.uqac.lif.cep.EventTracker getCopy​(boolean with_state)
        Specified by:
        getCopy in interface ca.uqac.lif.cep.EventTracker