Class MessageNumberIndexFunction

  • All Implemented Interfaces:
    edu.uci.ics.jung.graph.util.EdgeIndexFunction

    public class MessageNumberIndexFunction
    extends java.lang.Object
    implements edu.uci.ics.jung.graph.util.EdgeIndexFunction
    A class which creates and maintains indices for the edges so that parallel edges are sorted. In this case the edges are sorted by the sequence number of the message. This only applies for the directed multigraph because in any other case only one message is in the edge (message group).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map edge_index
      The map of edge indices
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int getIndex​(edu.uci.ics.jung.graph.Graph graph, GraphCanvas.MessageGroup e, GraphCanvas.AgentGroup v)
      Returns the index for the message group.
      protected int getIndex​(edu.uci.ics.jung.graph.Graph graph, GraphCanvas.MessageGroup group, GraphCanvas.AgentGroup agents1, GraphCanvas.AgentGroup agents2)
      Returns the index for the message group.
      int getIndex​(edu.uci.ics.jung.graph.Graph graph, java.lang.Object group)
      Returns the index for the specified message group.
      void reset()
      Clears all edge indices for all edges in all graphs.
      void reset​(edu.uci.ics.jung.graph.Graph graph, java.lang.Object group)
      Resets the indices for this edge group and its parallel groups.
      • Methods inherited from class java.lang.Object

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

      • edge_index

        protected java.util.Map edge_index
        The map of edge indices
    • Constructor Detail

      • MessageNumberIndexFunction

        public MessageNumberIndexFunction()
    • Method Detail

      • getIndex

        public int getIndex​(edu.uci.ics.jung.graph.Graph graph,
                            java.lang.Object group)
        Returns the index for the specified message group. Calculates the indices for the current group and for all groups parallel to this group. Only groups with only one containing message are considered.
        Specified by:
        getIndex in interface edu.uci.ics.jung.graph.util.EdgeIndexFunction
        Parameters:
        graph - The graph.
        group - The message group.
        Returns:
        The index for the message group.
      • reset

        public void reset​(edu.uci.ics.jung.graph.Graph graph,
                          java.lang.Object group)
        Resets the indices for this edge group and its parallel groups. Should be invoked when an edge parallel to the group has been added or removed.
        Specified by:
        reset in interface edu.uci.ics.jung.graph.util.EdgeIndexFunction
        Parameters:
        group -
      • reset

        public void reset()
        Clears all edge indices for all edges in all graphs. Does not recalculate the indices.
        Specified by:
        reset in interface edu.uci.ics.jung.graph.util.EdgeIndexFunction
      • getIndex

        protected int getIndex​(edu.uci.ics.jung.graph.Graph graph,
                               GraphCanvas.MessageGroup group,
                               GraphCanvas.AgentGroup agents1,
                               GraphCanvas.AgentGroup agents2)
        Returns the index for the message group.
        Parameters:
        graph - The graph.
        group - The message group.
        agents1 - The first agent group.
        agents2 - The second agent group.
        Returns:
        The index of the message group.
      • getIndex

        protected int getIndex​(edu.uci.ics.jung.graph.Graph graph,
                               GraphCanvas.MessageGroup e,
                               GraphCanvas.AgentGroup v)
        Returns the index for the message group.
        Parameters:
        graph - The graph.
        e - The message group.
        v - The agent group.
        Returns:
        The index of the group.