/** * Get the int at the location specified by index. * @return int * @param index int */ public final int intAt(int index) { /*if (index > size-1) { throw new IndexOutOfBoundsException(); }*/ // int pageNum = (int) index / pageSize; int pageNum = index>>exp; //System.out.println("page Number is "+pageNum); // int offset = index % pageSize; int offset = index & r; return ((int[]) bufferArrayList.get(pageNum))[offset]; } /**
/** * Get the int at the location specified by index. * @return int * @param index int */ public int intAt(int index) { /*if (index > size-1) { throw new IndexOutOfBoundsException(); }*/ // int pageNum = (int) index / pageSize; int pageNum = index>>exp; //System.out.println("page Number is "+pageNum); // int offset = index % pageSize; int offset = index & r; return ((int[]) bufferArrayList.get(pageNum))[offset]; } /**
/** * Get the int at the location specified by index. * @return int * @param index int */ public final int intAt(int index) { /*if (index > size-1) { throw new IndexOutOfBoundsException(); }*/ // int pageNum = (int) index / pageSize; int pageNum = index>>exp; //System.out.println("page Number is "+pageNum); // int offset = index % pageSize; int offset = index & r; return ((int[]) bufferArrayList.get(pageNum))[offset]; } /**
/** * Assigns a new int value to location index of the buffer instance. * @param index int * @param newValue int */ public final void modifyEntry(int index, Object newValue) { if (index > size - 1) { throw new IndexOutOfBoundsException(); } // ((int[]) bufferArrayList.get((int) (index / pageSize)))[index % pageSize] = ((Object[]) bufferArrayList.get((index >> exp)))[index & r] = newValue; } /**
/** * Assigns a new int value to location index of the buffer instance. * @param index int * @param newValue int */ public final void modifyEntry(int index, Object newValue) { if (index > size - 1) { throw new IndexOutOfBoundsException(); } // ((int[]) bufferArrayList.get((int) (index / pageSize)))[index % pageSize] = ((Object[]) bufferArrayList.get((index >> exp)))[index & r] = newValue; } /**
/** * Assigns a new int value to location index of the buffer instance. * @param index int * @param newValue int */ public final void modifyEntry(int index, Object newValue) { if (index > size - 1) { throw new IndexOutOfBoundsException(); } // ((int[]) bufferArrayList.get((int) (index / pageSize)))[index % pageSize] = ((Object[]) bufferArrayList.get((index >> exp)))[index & r] = newValue; } /**
/** * Get the object at the location specified by index. * @return int * @param index int */ public final Object objectAt(int index) { if ( index > size-1) { throw new IndexOutOfBoundsException(); } // int pageNum = (int) index / pageSize; int pageNum = index>>exp; //System.out.println("page Number is "+pageNum); // int offset = index % pageSize; int offset = index & r; return ((Object[]) bufferArrayList.get(pageNum))[offset]; } /**
/** * Get the object at the location specified by index. * @return int * @param index int */ public final Object objectAt(int index) { if ( index > size-1) { throw new IndexOutOfBoundsException(); } // int pageNum = (int) index / pageSize; int pageNum = index>>exp; //System.out.println("page Number is "+pageNum); // int offset = index % pageSize; int offset = index & r; return ((Object[]) bufferArrayList.get(pageNum))[offset]; } /**
/** * Get the object at the location specified by index. * @return int * @param index int */ public final Object objectAt(int index) { if ( index > size-1) { throw new IndexOutOfBoundsException(); } // int pageNum = (int) index / pageSize; int pageNum = index>>exp; //System.out.println("page Number is "+pageNum); // int offset = index % pageSize; int offset = index & r; return ((Object[]) bufferArrayList.get(pageNum))[offset]; } /**
/** * Returns the object array corresponding to all objects in this buffer instance * @return Object[] (null if the buffer is empty) */ public Object[] toObjectArray() { if (size > 0) { int s = size; Object[] resultArray = new Object[size]; //copy all the content int into the resultArray int array_offset = 0; for (int i = 0; s>0; i++) { System.arraycopy( (Object[]) bufferArrayList.get(i), 0, resultArray, array_offset, (s<pageSize) ? s : pageSize); // (i == (bufferArrayList.size() - 1)) ? size() % pageSize : pageSize); s = s - pageSize; array_offset += pageSize; } return resultArray; } return null; }
/** * Returns the object array corresponding to all objects in this buffer instance * @return Object[] (null if the buffer is empty) */ public Object[] toObjectArray() { if (size > 0) { int s = size; Object[] resultArray = new Object[size]; //copy all the content int into the resultArray int array_offset = 0; for (int i = 0; s>0; i++) { System.arraycopy( (Object[]) bufferArrayList.get(i), 0, resultArray, array_offset, (s<pageSize) ? s : pageSize); // (i == (bufferArrayList.size() - 1)) ? size() % pageSize : pageSize); s = s - pageSize; array_offset += pageSize; } return resultArray; } return null; }
/** * Returns the int array corresponding to all int values in this buffer instance * @return int[] (null if the buffer is empty) */ public int[] toIntArray() { if (size > 0) { int s = size; int[] resultArray = new int[size]; //copy all the content int into the resultArray int array_offset = 0; for (int i = 0; s>0; i++) { System.arraycopy( (int[]) bufferArrayList.get(i), 0, resultArray, array_offset, (s<pageSize) ? s : pageSize); // (i == (bufferArrayList.size() - 1)) ? size() % pageSize : pageSize); s = s - pageSize; array_offset += pageSize; } return resultArray; } return null; }
/** * Returns the int array corresponding to all int values in this buffer instance * @return int[] (null if the buffer is empty) */ public int[] toIntArray() { if (size > 0) { int s = size; int[] resultArray = new int[size]; //copy all the content int into the resultArray int array_offset = 0; for (int i = 0; s>0; i++) { System.arraycopy( (int[]) bufferArrayList.get(i), 0, resultArray, array_offset, (s<pageSize) ? s : pageSize); // (i == (bufferArrayList.size() - 1)) ? size() % pageSize : pageSize); s = s - pageSize; array_offset += pageSize; } return resultArray; } return null; }
/** * Returns the object array corresponding to all objects in this buffer instance * @return Object[] (null if the buffer is empty) */ public Object[] toObjectArray() { if (size > 0) { int s = size; Object[] resultArray = new Object[size]; //copy all the content int into the resultArray int array_offset = 0; for (int i = 0; s>0; i++) { System.arraycopy( (Object[]) bufferArrayList.get(i), 0, resultArray, array_offset, (s<pageSize) ? s : pageSize); // (i == (bufferArrayList.size() - 1)) ? size() % pageSize : pageSize); s = s - pageSize; array_offset += pageSize; } return resultArray; } return null; }
/** * Returns the int array corresponding to all int values in this buffer instance * @return int[] (null if the buffer is empty) */ public int[] toIntArray() { if (size > 0) { int s = size; int[] resultArray = new int[size]; //copy all the content int into the resultArray int array_offset = 0; for (int i = 0; s>0; i++) { System.arraycopy( (int[]) bufferArrayList.get(i), 0, resultArray, array_offset, (s<pageSize) ? s : pageSize); // (i == (bufferArrayList.size() - 1)) ? size() % pageSize : pageSize); s = s - pageSize; array_offset += pageSize; } return resultArray; } return null; }