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 aIndexGraph
chooses to swap two IDs (vertices/edges).The
int
identifiers anIndexGraph
uses for its vertices are always0,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 usingIndexGraph.addVertexSwapListener(IndexSwapListener)
andIndexGraph.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 whenidx1
andidx2
are swapped.
-
-
-
Method Detail
-
swap
void swap(int idx1, int idx2)
A callback that is called whenidx1
andidx2
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 indexidx2
- the second element index
-
-