/** {@inheritDoc} */ @Override public ObjectId getObject(int position) throws IllegalArgumentException { ObjectId objectId = byOffset.get(position); if (objectId == null) throw new IllegalArgumentException(); return objectId; }
MutableEntry getObject(int position) { try { MutableEntry entry = revList.get(position); if (entry == null) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().objectNotFound, String.valueOf(position))); return entry; } catch (IndexOutOfBoundsException ex) { throw new IllegalArgumentException(ex); } }
/** {@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 void cutDeltaChains(BlockList<ObjectToPack> list) throws IOException { int max = config.getMaxDeltaDepth(); for (int idx = list.size() - 1; idx >= 0; idx--) { int d = 0; ObjectToPack b = list.get(idx).getDeltaBase(); while (b != null) { if (d < b.getChainLength()) break; b.setChainLength(++d); if (d >= max && b.isDeltaRepresentation()) { reselectNonDelta(b); break; } b = b.getDeltaBase(); } } if (config.isDeltaCompress()) { for (ObjectToPack otp : list) otp.clearChainLength(); } }
@Override public ObjectId getObject(int position) throws IllegalArgumentException { ObjectId objectId = byOffset.get(position); if (objectId == null) throw new IllegalArgumentException(); return objectId; }
/** {@inheritDoc} */ @Override public ObjectId getObject(int position) throws IllegalArgumentException { ObjectId objectId = byOffset.get(position); if (objectId == null) throw new IllegalArgumentException(); return objectId; }
MutableEntry getObject(int position) { try { MutableEntry entry = revList.get(position); if (entry == null) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().objectNotFound, String.valueOf(position))); return entry; } catch (IndexOutOfBoundsException ex) { throw new IllegalArgumentException(ex); } }
MutableEntry getObject(int position) { try { MutableEntry entry = revList.get(position); if (entry == null) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().objectNotFound, String.valueOf(position))); return entry; } catch (IndexOutOfBoundsException ex) { throw new IllegalArgumentException(ex); } }
@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); } }
@Override public T remove(int index) { if (index == size - 1) { // Fast-path: remove the last element. T[] blockRef = directory[toDirectoryIndex(index)]; int blockIdx = toBlockIndex(index); T old = blockRef[blockIdx]; blockRef[blockIdx] = null; size--; if (0 < tailBlkIdx) tailBlkIdx--; else resetTailBlock(); return old; } else if (index < 0 || size <= index) { throw new IndexOutOfBoundsException(String.valueOf(index)); } else { // Slow-path: the list needs to contract and remove. // Do this the naive way, callers shouldn't abuse // this class by entering this code path. // T old = get(index); for (; index < size - 1; index++) set(index, get(index + 1)); set(size - 1, null); size--; resetTailBlock(); return old; } }
private void cutDeltaChains(BlockList<ObjectToPack> list) throws IOException { int max = config.getMaxDeltaDepth(); for (int idx = list.size() - 1; idx >= 0; idx--) { int d = 0; ObjectToPack b = list.get(idx).getDeltaBase(); while (b != null) { if (d < b.getChainLength()) break; b.setChainLength(++d); if (d >= max && b.isDeltaRepresentation()) { reselectNonDelta(b); break; } b = b.getDeltaBase(); } } if (config.isDeltaCompress()) { for (ObjectToPack otp : list) otp.clearChainLength(); } }
private void cutDeltaChains(BlockList<ObjectToPack> list) throws IOException { int max = config.getMaxDeltaDepth(); for (int idx = list.size() - 1; idx >= 0; idx--) { int d = 0; ObjectToPack b = list.get(idx).getDeltaBase(); while (b != null) { if (d < b.getChainLength()) break; b.setChainLength(++d); if (d >= max && b.isDeltaRepresentation()) { reselectNonDelta(b); break; } b = b.getDeltaBase(); } } if (config.isDeltaCompress()) { for (ObjectToPack otp : list) otp.clearChainLength(); } }