Interface IndexSwapListener

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface IndexSwapListener
    A listener that will be notified when a IndexGraph chooses to swap two IDs (vertices/edges).

    The int identifiers an IndexGraph uses for its vertices are always 0,1,2,...,verticesNum (and similarly for its edges). To maintain this invariant the graph implementations way swap and rename its vertices (edges) during its lifetime. It's possible to register to these swaps using IndexGraph.addVertexSwapListener(IndexSwapListener) and IndexGraph.addEdgeSwapListener(IndexSwapListener), which ensure a callback listener will be notified when such swaps occur.

    The same swap listener interface is used for both vertices and edges (a specific instance is only used to one of them, which can be determined by the context), and we use a unified term element in the documentation to refer to either of them.

    Author:
    Barak Ugav
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void swap​(int idx1, int idx2)
      A callback that is called when idx1 and idx2 are swapped.
    • Method Detail

      • swap

        void swap​(int idx1,
                  int idx2)
        A callback that is called when idx1 and idx2 are swapped.

        The same swap listener interface is used for both vertices and edges (a specific instance is only used to one of them, which can be determined by the context), and we use a unified term element in the documentation to refer to either of them.

        Parameters:
        idx1 - the first element index
        idx2 - the second element index