Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. private FunctionNode getNodeByIndex(int index) {
  2.         if (index < 0) throw new FunctionPointIndexOutOfBoundsException("Incorrect index");
  3.         if (currentIndex <= index) {
  4.             while (currentIndex < index) {
  5.                 currentFunctionNode = currentFunctionNode.pointNext;
  6.                 ++currentIndex;
  7.             }
  8.         } else {
  9.             while (index < currentIndex) {
  10.                 currentFunctionNode = currentFunctionNode.pointPrev;
  11.                 --currentIndex;
  12.             }
  13.         }
  14.         return currentFunctionNode;
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement