Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

HashedSequence.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (C) 2010, Google Inc. and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.diff;
  11. /**
  12. * Wraps a {@link org.eclipse.jgit.diff.Sequence} to assign hash codes to
  13. * elements.
  14. * <p>
  15. * This sequence acts as a proxy for the real sequence, caching element hash
  16. * codes so they don't need to be recomputed each time. Sequences of this type
  17. * must be used with a {@link org.eclipse.jgit.diff.HashedSequenceComparator}.
  18. * <p>
  19. * To construct an instance of this type use
  20. * {@link org.eclipse.jgit.diff.HashedSequencePair}.
  21. *
  22. * @param <S>
  23. * the base sequence type.
  24. */
  25. public final class HashedSequence<S extends Sequence> extends Sequence {
  26. final S base;
  27. final int[] hashes;
  28. HashedSequence(S base, int[] hashes) {
  29. this.base = base;
  30. this.hashes = hashes;
  31. }
  32. /** {@inheritDoc} */
  33. @Override
  34. public int size() {
  35. return base.size();
  36. }
  37. }