Tabnine Logo
RefComparator
Code IndexAdd Tabnine to your IDE (free)

How to use
RefComparator
in
org.eclipse.jgit.lib

Best Java code snippets using org.eclipse.jgit.lib.RefComparator (Showing top 20 results out of 315)

origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * <p>Constructor for RefWriter.</p>
 *
 * @param refs
 *            the complete set of references. This should have been computed
 *            by applying updates to the advertised refs already discovered.
 */
public RefWriter(Collection<Ref> refs) {
  this.refs = RefComparator.sort(refs);
}
origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public int compare(Ref o1, Ref o2) {
  return compareTo(o1, o2);
}
origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * <p>Constructor for RefWriter.</p>
 *
 * @param refs
 *            the complete set of references. This should have been computed
 *            by applying updates to the advertised refs already discovered.
 */
public RefWriter(Map<String, Ref> refs) {
  if (refs instanceof RefMap)
    this.refs = refs.values();
  else
    this.refs = RefComparator.sort(refs.values());
}
origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Locate an entry by name.
 *
 * @param name
 *            the name of the reference to find.
 * @return the index the reference is at. If the entry is not present
 *         returns a negative value. The insertion position for the given
 *         name can be computed from {@code -(index + 1)}.
 */
public final int find(String name) {
  int high = cnt;
  if (high == 0)
    return -1;
  int low = 0;
  do {
    final int mid = (low + high) >>> 1;
    final int cmp = RefComparator.compareTo(list[mid], name);
    if (cmp < 0)
      low = mid + 1;
    else if (cmp == 0)
      return mid;
    else
      high = mid;
  } while (low < high);
  return -(low + 1);
}
origin: berlam/github-bucket

/**
 * <p>Constructor for RefWriter.</p>
 *
 * @param refs
 *            the complete set of references. This should have been computed
 *            by applying updates to the advertised refs already discovered.
 */
public RefWriter(Collection<Ref> refs) {
  this.refs = RefComparator.sort(refs);
}
origin: org.eclipse.jgit/org.eclipse.jgit

private Ref resolveLoose(Ref l) {
  if (resolvedIdx < resolved.size()) {
    Ref r = resolved.get(resolvedIdx);
    int cmp = RefComparator.compareTo(l, r);
    if (cmp == 0) {
      resolvedIdx++;
      return r;
    } else if (cmp > 0) {
      // WTF, we have a symbolic entry but no match
      // in the loose collection. That's an error.
      throw new IllegalStateException();
    }
  }
  return l;
}
origin: sonia.jgit/org.eclipse.jgit

/**
 * @param refs
 *            the complete set of references. This should have been computed
 *            by applying updates to the advertised refs already discovered.
 */
public RefWriter(Collection<Ref> refs) {
  this.refs = RefComparator.sort(refs);
}
origin: org.eclipse.jgit/org.eclipse.jgit

else
  cur = new ObjectIdRef.Unpeeled(PACKED, name, id);
if (last != null && RefComparator.compareTo(last, cur) > 0)
  needSort = true;
all.add(cur);
origin: sonia.jgit/org.eclipse.jgit

/**
 * @param refs
 *            the complete set of references. This should have been computed
 *            by applying updates to the advertised refs already discovered.
 */
public RefWriter(Map<String, Ref> refs) {
  if (refs instanceof RefMap)
    this.refs = refs.values();
  else
    this.refs = RefComparator.sort(refs.values());
}
origin: berlam/github-bucket

/** {@inheritDoc} */
@Override
public int compare(Ref o1, Ref o2) {
  return compareTo(o1, o2);
}
origin: berlam/github-bucket

/**
 * <p>Constructor for RefWriter.</p>
 *
 * @param refs
 *            the complete set of references. This should have been computed
 *            by applying updates to the advertised refs already discovered.
 */
public RefWriter(Map<String, Ref> refs) {
  if (refs instanceof RefMap)
    this.refs = refs.values();
  else
    this.refs = RefComparator.sort(refs.values());
}
origin: sonia.jgit/org.eclipse.jgit

public int compare(final Ref o1, final Ref o2) {
  return compareTo(o1, o2);
}
origin: sonia.jgit/org.eclipse.jgit

private Iterable<Ref> getSortedRefs(Map<String, Ref> all) {
  if (all instanceof RefMap
      || (all instanceof SortedMap && ((SortedMap) all).comparator() == null))
    return all.values();
  return RefComparator.sort(all.values());
}
origin: berlam/github-bucket

/**
 * Locate an entry by name.
 *
 * @param name
 *            the name of the reference to find.
 * @return the index the reference is at. If the entry is not present
 *         returns a negative value. The insertion position for the given
 *         name can be computed from {@code -(index + 1)}.
 */
public final int find(String name) {
  int high = cnt;
  if (high == 0)
    return -1;
  int low = 0;
  do {
    final int mid = (low + high) >>> 1;
    final int cmp = RefComparator.compareTo(list[mid], name);
    if (cmp < 0)
      low = mid + 1;
    else if (cmp == 0)
      return mid;
    else
      high = mid;
  } while (low < high);
  return -(low + 1);
}
origin: org.eclipse.jgit/org.eclipse.jgit

for (Ref ref : RefComparator.sort(refs)) {
origin: sonia.jgit/org.eclipse.jgit

/**
 * Locate an entry by name.
 *
 * @param name
 *            the name of the reference to find.
 * @return the index the reference is at. If the entry is not present
 *         returns a negative value. The insertion position for the given
 *         name can be computed from {@code -(index + 1)}.
 */
public final int find(String name) {
  int high = cnt;
  if (high == 0)
    return -1;
  int low = 0;
  do {
    final int mid = (low + high) >>> 1;
    final int cmp = RefComparator.compareTo(list[mid], name);
    if (cmp < 0)
      low = mid + 1;
    else if (cmp == 0)
      return mid;
    else
      high = mid;
  } while (low < high);
  return -(low + 1);
}
origin: com.madgag/org.eclipse.jgit.pgm

private void addRefs(final Collection<Ref> refs, final String prefix) {
  for (final Ref ref : RefComparator.sort(refs)) {
    final String name = ref.getName();
    if (name.startsWith(prefix))
      addRef(name.substring(name.indexOf('/', 5) + 1), ref);
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit

do {
  cur = curLoose.get(curIdx);
  int cmp = RefComparator.compareTo(cur, name);
  if (cmp < 0) {
origin: com.madgag/org.eclipse.jgit.pgm

private Iterable<Ref> getSortedRefs() throws Exception {
  Map<String, Ref> all = db.getRefDatabase().getRefs(ALL);
  if (all instanceof RefMap
      || (all instanceof SortedMap && ((SortedMap) all).comparator() == null))
    return all.values();
  return RefComparator.sort(all.values());
}
origin: org.eclipse.jgit/org.eclipse.jgit

public Entry<String, Ref> peek() {
  if (packedIdx < packed.size() && looseIdx < loose.size()) {
    Ref p = packed.get(packedIdx);
    Ref l = loose.get(looseIdx);
    int cmp = RefComparator.compareTo(p, l);
    if (cmp < 0) {
      packedIdx++;
      return toEntry(p);
    }
    if (cmp == 0)
      packedIdx++;
    looseIdx++;
    return toEntry(resolveLoose(l));
  }
  if (looseIdx < loose.size())
    return toEntry(resolveLoose(loose.get(looseIdx++)));
  if (packedIdx < packed.size())
    return toEntry(packed.get(packedIdx++));
  return null;
}
org.eclipse.jgit.libRefComparator

Javadoc

Util for sorting (or comparing) Ref instances by name.

Useful for command line tools or writing out refs to file.

Most used methods

  • sort
    Sorts the collection of refs, returning a new collection.
  • compareTo
    Compare two references by name.

Popular in Java

  • Creating JSON documents from java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
  • onCreateOptionsMenu (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Permission (java.security)
    Legacy security code; do not use.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • JCheckBox (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now