Interface ForestChangeEventHandler
public interface ForestChangeEventHandler
This interface may be used to collect additional information while forest changes are being made. An instance of
ForestChangeEventHandler is passed to one of the mutator methods of the Forest
instance like Forest#moveSubtree(long, long, long, ForestChangeEventHandler) and corresponding methods
are called before or after the change is made to the forest.- Author:
- Igor Sereda
-
Method Summary
Modifier and TypeMethodDescriptionvoidafterForestInserted(Forest forest, int fromIndex, int toIndex, Forest insertedForest) Called at the moment after another forest is added to the forest being observed.voidbeforeSubtreeRemoved(Forest forest, int fromIndex, int toIndex, Forest removedSubtree) Called at the moment before a subtree is removed from the forest.
-
Method Details
-
beforeSubtreeRemoved
Called at the moment before a subtree is removed from the forest.
The code must not modify the forests, otherwise the result is undefined.
- Parameters:
forest- the forest being changedfromIndex- the index of the root element of the subtreetoIndex- the index of an element that follows the removed subtree (or the size of the forest if the subtree is at the end of the forest). Invariant:toIndex == forest.getSubtreeEnd(fromIndex)removedSubtree- the copy of the subtree being removed
-
afterForestInserted
Called at the moment after another forest is added to the forest being observed. The added forest completely resides under a certain parent issue, or at the top level. In other words, it is impossible that any issue within range
[fromIndex, toIndex)has depth less than the first issue of the added forest[fromIndex].The code must not modify the forests, otherwise the result is undefined.
- Parameters:
forest- the forest being changedfromIndex- the index of the first element being insertedtoIndex- the index of an element that follows the added part of the forest (or the size of the forest if the issues are added at the end).insertedForest- the forest that has been inserted
-