/** * Quickly append all elements from an array. * * @param src * the source array. * @param srcIdx * first index to copy. * @param srcCnt * number of elements to copy. */ public void addAll(T[] src, int srcIdx, int srcCnt) { while (0 < srcCnt) { int i = tailBlkIdx; int n = Math.min(srcCnt, BLOCK_SIZE - i); if (n == 0) { // Our tail is full, expand by one. add(src[srcIdx++]); srcCnt--; continue; } System.arraycopy(src, srcIdx, tailBlock, i, n); tailBlkIdx += n; size += n; srcIdx += n; srcCnt -= n; } }
/** {@inheritDoc} */ @Override public void add(int index, T element) { if (index == size) { // Fast-path: append onto the end of the list. add(element); } else if (index < 0 || size < index) { throw new IndexOutOfBoundsException(String.valueOf(index)); } else { // Slow-path: the list needs to expand and insert. // Do this the naive way, callers shouldn't abuse // this class by entering this code path. // add(null); // expand the list by one for (int oldIdx = size - 2; index <= oldIdx; oldIdx--) set(oldIdx + 1, get(oldIdx)); set(index, element); } }
private static void sortByOffsetAndIndex(BlockList<PositionEntry> byOffset, ObjectIdOwnerMap<PositionEntry> positionEntries, List<ObjectToPack> entries) { for (int i = 0; i < entries.size(); i++) { positionEntries.add(new PositionEntry(entries.get(i), i)); } Collections.sort(entries, new Comparator<ObjectToPack>() { @Override public int compare(ObjectToPack a, ObjectToPack b) { return Long.signum(a.getOffset() - b.getOffset()); } }); for (int i = 0; i < entries.size(); i++) { PositionEntry e = positionEntries.get(entries.get(i)); e.offsetPosition = i; byOffset.add(e); } }
int findOrInsert(AnyObjectId objectId, int type) { MutableEntry entry = new MutableEntry( objectId, type, revList.size()); revList.add(entry); revMap.add(entry); return entry.position; } }
private void addObject( final AnyObjectId src, final int type, final int pathHashCode) { final ObjectToPack otp; if (reuseSupport != null) otp = reuseSupport.newObjectToPack(src, type); else otp = new ObjectToPack(src, type); otp.setPathHash(pathHashCode); objectsLists[type].add(otp); objectsMap.add(otp); }
/** * Stores the bitmap for the objectId. * * @param objectId * the object id key for the bitmap. * @param bitmap * the bitmap * @param flags * the flags to be stored with the bitmap */ public void addBitmap( AnyObjectId objectId, EWAHCompressedBitmap bitmap, int flags) { bitmap.trim(); StoredBitmap result = new StoredBitmap(objectId, bitmap, null, flags); getBitmaps().add(result); byAddOrder.add(result); }
commits.add(c); if (c.getParentCount() == 0) { roots.add(c.copy());
/** * Quickly append all elements from an array. * * @param src * the source array. * @param srcIdx * first index to copy. * @param srcCnt * number of elements to copy. */ public void addAll(T[] src, int srcIdx, int srcCnt) { while (0 < srcCnt) { int i = tailBlkIdx; int n = Math.min(srcCnt, BLOCK_SIZE - i); if (n == 0) { // Our tail is full, expand by one. add(src[srcIdx++]); srcCnt--; continue; } System.arraycopy(src, srcIdx, tailBlock, i, n); tailBlkIdx += n; size += n; srcIdx += n; srcCnt -= n; } }
collisionCheckObjs.add(obj);
@Override public void add(int index, T element) { if (index == size) { // Fast-path: append onto the end of the list. add(element); } else if (index < 0 || size < index) { throw new IndexOutOfBoundsException(String.valueOf(index)); } else { // Slow-path: the list needs to expand and insert. // Do this the naive way, callers shouldn't abuse // this class by entering this code path. // add(null); // expand the list by one for (int oldIdx = size - 2; index <= oldIdx; oldIdx--) set(oldIdx + 1, get(oldIdx)); set(index, element); } }
/** {@inheritDoc} */ @Override public void add(int index, T element) { if (index == size) { // Fast-path: append onto the end of the list. add(element); } else if (index < 0 || size < index) { throw new IndexOutOfBoundsException(String.valueOf(index)); } else { // Slow-path: the list needs to expand and insert. // Do this the naive way, callers shouldn't abuse // this class by entering this code path. // add(null); // expand the list by one for (int oldIdx = size - 2; index <= oldIdx; oldIdx--) set(oldIdx + 1, get(oldIdx)); set(index, element); } }
private static void sortByOffsetAndIndex(BlockList<PositionEntry> byOffset, ObjectIdOwnerMap<PositionEntry> positionEntries, List<ObjectToPack> entries) { for (int i = 0; i < entries.size(); i++) { positionEntries.add(new PositionEntry(entries.get(i), i)); } Collections.sort(entries, new Comparator<ObjectToPack>() { public int compare(ObjectToPack a, ObjectToPack b) { return Long.signum(a.getOffset() - b.getOffset()); } }); for (int i = 0; i < entries.size(); i++) { PositionEntry e = positionEntries.get(entries.get(i)); e.offsetPosition = i; byOffset.add(e); } }
private static void sortByOffsetAndIndex(BlockList<PositionEntry> byOffset, ObjectIdOwnerMap<PositionEntry> positionEntries, List<ObjectToPack> entries) { for (int i = 0; i < entries.size(); i++) { positionEntries.add(new PositionEntry(entries.get(i), i)); } Collections.sort(entries, new Comparator<ObjectToPack>() { @Override public int compare(ObjectToPack a, ObjectToPack b) { return Long.signum(a.getOffset() - b.getOffset()); } }); for (int i = 0; i < entries.size(); i++) { PositionEntry e = positionEntries.get(entries.get(i)); e.offsetPosition = i; byOffset.add(e); } }
int findOrInsert(AnyObjectId objectId, int type) { MutableEntry entry = new MutableEntry( objectId, type, revList.size()); revList.add(entry); revMap.add(entry); return entry.position; } }
int findOrInsert(AnyObjectId objectId, int type) { MutableEntry entry = new MutableEntry( objectId, type, revList.size()); revList.add(entry); revMap.add(entry); return entry.position; } }
private void addObject( final AnyObjectId src, final int type, final int pathHashCode) { final ObjectToPack otp; if (reuseSupport != null) otp = reuseSupport.newObjectToPack(src, type); else otp = new ObjectToPack(src, type); otp.setPathHash(pathHashCode); objectsLists[type].add(otp); objectsMap.add(otp); }
private void addObject( final AnyObjectId src, final int type, final int pathHashCode) { final ObjectToPack otp; if (reuseSupport != null) otp = reuseSupport.newObjectToPack(src, type); else otp = new ObjectToPack(src, type); otp.setPathHash(pathHashCode); objectsLists[type].add(otp); objectsMap.add(otp); }
/** * Stores the bitmap for the objectId. * * @param objectId * the object id key for the bitmap. * @param bitmap * the bitmap * @param flags * the flags to be stored with the bitmap */ public void addBitmap( AnyObjectId objectId, EWAHCompressedBitmap bitmap, int flags) { bitmap.trim(); StoredBitmap result = new StoredBitmap(objectId, bitmap, null, flags); getBitmaps().add(result); byAddOrder.add(result); }
/** * Stores the bitmap for the objectId. * * @param objectId * the object id key for the bitmap. * @param bitmap * the bitmap * @param flags * the flags to be stored with the bitmap */ public void addBitmap( AnyObjectId objectId, EWAHCompressedBitmap bitmap, int flags) { bitmap.trim(); StoredBitmap result = new StoredBitmap(objectId, bitmap, null, flags); getBitmaps().add(result); byAddOrder.add(result); }