class CircularIndex {

    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;
    }

    public  CircularIndex(long capacity);
    public  CircularIndex(long capacity, boolean resetOnZero);
    public  CircularIndex(long capacity, long first, long size);
    public  CircularIndex(long capacity, long first, long size, boolean resetOnZero);

}