test_class.file: ch-commons-util/src/test/java/com/cloudhopper/commons/util/CircularIndexTest.java
test_class.identifier: CircularIndexTest
test_case.body: @Test
      public void calculateNextIndex() throws Exception {
          CircularIndex index = new CircularIndex(4);
  
          Assert.assertEquals(1, index.calculateNewIndex(0, 1));
          Assert.assertEquals(2, index.calculateNewIndex(1, 1));
          Assert.assertEquals(3, index.calculateNewIndex(2, 1));
          Assert.assertEquals(0, index.calculateNewIndex(3, 1));
          // handle wraparound -- one previous from zero is the end
          Assert.assertEquals(3, index.calculateNewIndex(0, -1));
          Assert.assertEquals(2, index.calculateNewIndex(0, -2));
      }
test_case.class_method_signature: CircularIndexTest.calculateNextIndex()
test_case.full_signature: @Test public void calculateNextIndex()
test_case.identifier: calculateNextIndex
test_case.invocations: assertEquals calculateNewIndex assertEquals calculateNewIndex assertEquals calculateNewIndex assertEquals calculateNewIndex assertEquals calculateNewIndex assertEquals calculateNewIndex
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void calculateNextIndex()
focal_class.declarator: logger = LoggerFactory.getLogger(CircularIndex.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger logger = LoggerFactory.getLogger(CircularIndex.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: resetOnZero
focal_class.modifier: private
focal_class.original_string: private boolean resetOnZero;
focal_class.type: boolean
focal_class.var_name: resetOnZero
focal_class.declarator: capacity
focal_class.modifier: private
focal_class.original_string: private long capacity;
focal_class.type: long
focal_class.var_name: capacity
focal_class.declarator: size
focal_class.modifier: private
focal_class.original_string: private long size;
focal_class.type: long
focal_class.var_name: size
focal_class.declarator: first
focal_class.modifier: private
focal_class.original_string: private long first;
focal_class.type: long
focal_class.var_name: first
focal_class.declarator: next
focal_class.modifier: private
focal_class.original_string: private long next;
focal_class.type: long
focal_class.var_name: next
focal_class.file: ch-commons-util/src/main/java/com/cloudhopper/commons/util/CircularIndex.java
focal_class.identifier: CircularIndex
focal_class.class_method_signature: CircularIndex.CircularIndex(long capacity)
focal_class.full_signature: public  CircularIndex(long capacity)
focal_class.identifier: CircularIndex
focal_class.modifiers: public
focal_class.parameters: (long capacity)
focal_class.signature:  CircularIndex(long capacity)
focal_class.class_method_signature: CircularIndex.CircularIndex(long capacity, boolean resetOnZero)
focal_class.full_signature: public  CircularIndex(long capacity, boolean resetOnZero)
focal_class.identifier: CircularIndex
focal_class.modifiers: public
focal_class.parameters: (long capacity, boolean resetOnZero)
focal_class.signature:  CircularIndex(long capacity, boolean resetOnZero)
focal_class.class_method_signature: CircularIndex.CircularIndex(long capacity, long first, long size)
focal_class.full_signature: public  CircularIndex(long capacity, long first, long size)
focal_class.identifier: CircularIndex
focal_class.modifiers: public
focal_class.parameters: (long capacity, long first, long size)
focal_class.signature:  CircularIndex(long capacity, long first, long size)
focal_class.class_method_signature: CircularIndex.CircularIndex(long capacity, long first, long size, boolean resetOnZero)
focal_class.full_signature: public  CircularIndex(long capacity, long first, long size, boolean resetOnZero)
focal_class.identifier: CircularIndex
focal_class.modifiers: public
focal_class.parameters: (long capacity, long first, long size, boolean resetOnZero)
focal_class.signature:  CircularIndex(long capacity, long first, long size, boolean resetOnZero)
focal_class.class_method_signature: CircularIndex.reset()
focal_class.full_signature: public void reset()
focal_class.identifier: reset
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void reset()
focal_class.class_method_signature: CircularIndex.checkReset()
focal_class.full_signature: private void checkReset()
focal_class.identifier: checkReset
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void checkReset()
focal_class.class_method_signature: CircularIndex.getCapacity()
focal_class.full_signature: public long getCapacity()
focal_class.identifier: getCapacity
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getCapacity()
focal_class.class_method_signature: CircularIndex.getMaxSize()
focal_class.full_signature: public long getMaxSize()
focal_class.identifier: getMaxSize
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getMaxSize()
focal_class.class_method_signature: CircularIndex.getSize()
focal_class.full_signature: public long getSize()
focal_class.identifier: getSize
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getSize()
focal_class.class_method_signature: CircularIndex.isEmpty()
focal_class.full_signature: public boolean isEmpty()
focal_class.identifier: isEmpty
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isEmpty()
focal_class.class_method_signature: CircularIndex.isFull()
focal_class.full_signature: public boolean isFull()
focal_class.identifier: isFull
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isFull()
focal_class.class_method_signature: CircularIndex.calculateNewIndex(long index, long offset)
focal_class.full_signature: protected long calculateNewIndex(long index, long offset)
focal_class.identifier: calculateNewIndex
focal_class.modifiers: protected
focal_class.parameters: (long index, long offset)
focal_class.return: long
focal_class.signature: long calculateNewIndex(long index, long offset)
focal_class.class_method_signature: CircularIndex.addLast()
focal_class.full_signature: public boolean addLast()
focal_class.identifier: addLast
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean addLast()
focal_class.class_method_signature: CircularIndex.addFirst()
focal_class.full_signature: public boolean addFirst()
focal_class.identifier: addFirst
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean addFirst()
focal_class.class_method_signature: CircularIndex.removeLast()
focal_class.full_signature: public boolean removeLast()
focal_class.identifier: removeLast
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean removeLast()
focal_class.class_method_signature: CircularIndex.removeFirst()
focal_class.full_signature: public boolean removeFirst()
focal_class.identifier: removeFirst
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean removeFirst()
focal_class.class_method_signature: CircularIndex.getFirst()
focal_class.full_signature: public long getFirst()
focal_class.identifier: getFirst
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getFirst()
focal_class.class_method_signature: CircularIndex.getLast()
focal_class.full_signature: public long getLast()
focal_class.identifier: getLast
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getLast()
focal_class.class_method_signature: CircularIndex.getNextLast()
focal_class.full_signature: public long getNextLast()
focal_class.identifier: getNextLast
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getNextLast()
focal_class.class_method_signature: CircularIndex.getNextFirst()
focal_class.full_signature: public long getNextFirst()
focal_class.identifier: getNextFirst
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getNextFirst()
focal_class.class_method_signature: CircularIndex.getInternalFirst()
focal_class.full_signature: protected long getInternalFirst()
focal_class.identifier: getInternalFirst
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getInternalFirst()
focal_class.class_method_signature: CircularIndex.getInternalNext()
focal_class.full_signature: protected long getInternalNext()
focal_class.identifier: getInternalNext
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getInternalNext()
focal_class.class_method_signature: CircularIndex.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_method.body: protected long calculateNewIndex(long index, long offset) {
          // capacity is added on LHS to handle negative offsets
          // Java does not handle negative modulous operands as I thought, so
          // this is a workaround to correctly calculate it
          return (index + capacity + offset) % capacity;
      }
focal_method.class_method_signature: CircularIndex.calculateNewIndex(long index, long offset)
focal_method.full_signature: protected long calculateNewIndex(long index, long offset)
focal_method.identifier: calculateNewIndex
focal_method.modifiers: protected
focal_method.parameters: (long index, long offset)
focal_method.return: long
focal_method.signature: long calculateNewIndex(long index, long offset)