Java 类com.google.common.collect.ImmutableSortedMultiset 实例源码

项目:presto    文件:Validator.java   
private static boolean resultsMatch(QueryResult controlResult, QueryResult testResult, int precision)
{
    SortedMultiset<List<Object>> control = ImmutableSortedMultiset.copyOf(rowComparator(precision), controlResult.getResults());
    SortedMultiset<List<Object>> test = ImmutableSortedMultiset.copyOf(rowComparator(precision), testResult.getResults());
    try {
        return control.equals(test);
    }
    catch (TypesDoNotMatchException e) {
        return false;
    }
}
项目:presto    文件:Validator.java   
public String getResultsComparison(int precision)
{
    List<List<Object>> controlResults = controlResult.getResults();
    List<List<Object>> testResults = testResult.getResults();

    if (valid() || (controlResults == null) || (testResults == null)) {
        return "";
    }

    Multiset<List<Object>> control = ImmutableSortedMultiset.copyOf(rowComparator(precision), controlResults);
    Multiset<List<Object>> test = ImmutableSortedMultiset.copyOf(rowComparator(precision), testResults);

    try {
        Iterable<ChangedRow> diff = ImmutableSortedMultiset.<ChangedRow>naturalOrder()
                .addAll(Iterables.transform(Multisets.difference(control, test), row -> new ChangedRow(Changed.REMOVED, row, precision)))
                .addAll(Iterables.transform(Multisets.difference(test, control), row -> new ChangedRow(Changed.ADDED, row, precision)))
                .build();
        diff = Iterables.limit(diff, 100);

        StringBuilder sb = new StringBuilder();

        sb.append(format("Control %s rows, Test %s rows%n", control.size(), test.size()));
        if (verboseResultsComparison) {
            Joiner.on("\n").appendTo(sb, diff);
        }
        else {
            sb.append("RESULTS DO NOT MATCH\n");
        }

        return sb.toString();
    }
    catch (TypesDoNotMatchException e) {
        return e.getMessage();
    }
}
项目:guava-stream    文件:MoreCollectorsTest.java   
@Test
public void testToImmutableSortedMultiset() throws Exception {
    ImmutableSortedMultiset<String> multiset = Stream.of("b", "c", "a", "a", "b", "a", "a", "f")
            .collect(MoreCollectors.toImmutableSortedMultiset());
    assertThat(multiset.size()).isEqualTo(8);
    assertThat(multiset.count("a")).isEqualTo(4);
    assertThat(multiset.count("b")).isEqualTo(2);
    assertThat(multiset.elementSet()).containsExactly("a", "b", "c", "f");
}
项目:guava-stream    文件:MoreCollectorsTest.java   
@Test
public void testToImmutableSortedMultisetWithComparator() throws Exception {
    ImmutableSortedMultiset<String> multiset = Stream.of("b", "c", "a", "a", "b", "a", "a", "f")
            .collect(MoreCollectors.toImmutableSortedMultiset((a, b) -> b.compareTo(a)));
    assertThat(multiset.size()).isEqualTo(8);
    assertThat(multiset.count("a")).isEqualTo(4);
    assertThat(multiset.count("b")).isEqualTo(2);
    assertThat(multiset.elementSet()).containsExactly("f", "c", "b", "a");
}
项目:GitHub    文件:SortedCollectionWrapper.java   
@Value.ReverseOrder
ImmutableSortedMultiset<Elem> getElemMultiset();
项目:GitHub    文件:SortedCollectionWrapper.java   
@Value.ReverseOrder
ImmutableSortedMultiset<ImmutableElem> getImmutableElemMultiset();
项目:guava-mock    文件:FreshValueGenerator.java   
@Generates private static <E extends Comparable<E>> ImmutableSortedMultiset<E>
    generateImmutableSortedMultiset(E freshElement) {
  return ImmutableSortedMultiset.of(freshElement);
}
项目:guava-mock    文件:FreshValueGeneratorTest.java   
public void testImmutableSortedMultiset() {
  assertFreshInstance(new TypeToken<ImmutableSortedMultiset<String>>() {});
}
项目:googles-monorepo-demo    文件:FreshValueGenerator.java   
@Generates private static <E extends Comparable<E>> ImmutableSortedMultiset<E>
    generateImmutableSortedMultiset(E freshElement) {
  return ImmutableSortedMultiset.of(freshElement);
}
项目:googles-monorepo-demo    文件:FreshValueGeneratorTest.java   
public void testImmutableSortedMultiset() {
  assertFreshInstance(new TypeToken<ImmutableSortedMultiset<String>>() {});
}
项目:guava-libraries    文件:FreshValueGenerator.java   
@Generates private static <E extends Comparable<E>> ImmutableSortedMultiset<E>
    generateImmutableSortedMultiset(E freshElement) {
  return ImmutableSortedMultiset.of(freshElement);
}
项目:guava-libraries    文件:FreshValueGeneratorTest.java   
public void testImmutableSortedMultiset() {
  assertFreshInstance(new TypeToken<ImmutableSortedMultiset<String>>() {});
}
项目:guava-stream    文件:MoreCollectors.java   
public static <T extends Comparable<T>> Collector<T, ?, ImmutableSortedMultiset<T>> toImmutableSortedMultiset() {
    return toImmutableSortedMultiset(Comparator.<T>naturalOrder());
}
项目:guava-stream    文件:MoreCollectors.java   
public static <T> Collector<T, ?, ImmutableSortedMultiset<T>> toImmutableSortedMultiset(Comparator<T> comparator) {
    return toImmutableMultiset(() -> ImmutableSortedMultiset.orderedBy(comparator), CONCURRENT);
}
项目:guava    文件:FreshValueGenerator.java   
@Generates
private static <E extends Comparable<E>>
    ImmutableSortedMultiset<E> generateImmutableSortedMultiset(E freshElement) {
  return ImmutableSortedMultiset.of(freshElement);
}
项目:guava    文件:FreshValueGeneratorTest.java   
public void testImmutableSortedMultiset() {
  assertFreshInstance(new TypeToken<ImmutableSortedMultiset<String>>() {});
}
项目:guava    文件:FreshValueGenerator.java   
@Generates
private static <E extends Comparable<E>>
    ImmutableSortedMultiset<E> generateImmutableSortedMultiset(E freshElement) {
  return ImmutableSortedMultiset.of(freshElement);
}
项目:guava    文件:FreshValueGeneratorTest.java   
public void testImmutableSortedMultiset() {
  assertFreshInstance(new TypeToken<ImmutableSortedMultiset<String>>() {});
}
项目:immutables    文件:SortedCollectionWrapper.java   
@Value.ReverseOrder
ImmutableSortedMultiset<Elem> getElemMultiset();
项目:immutables    文件:SortedCollectionWrapper.java   
@Value.ReverseOrder
ImmutableSortedMultiset<ImmutableElem> getImmutableElemMultiset();
项目:jannovar    文件:VariantAnnotations.java   
/**
 * Construct ImmutableAnnotationList from a {@link Collection} of {@link Annotation} objects.
 *
 * Note that <code>variant</code> is converted to the forward strand using {@link GenomeVariant#withStrand}.
 *
 * @param variant
 *            {@link GenomeVariant} that this anotation list annotates
 * @param entries
 *            {@link Collection} of {@link Annotation} objects
 */
public VariantAnnotations(GenomeVariant variant, Collection<Annotation> entries) {
    this.change = variant.withStrand(Strand.FWD);
    this.entries = ImmutableList.copyOf(ImmutableSortedMultiset.copyOf(entries));
}
项目:guava-factory    文件:Factory.java   
public static <E> ImmutableSortedMultiset<E> emptySortedMultiset() { return ImmutableSortedMultiset.of(); }
项目:guava-factory    文件:Factory.java   
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> sortedMultiset(E element) { return ImmutableSortedMultiset.of(element); }
项目:guava-factory    文件:Factory.java   
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> sortedMultiset(E e1, E e2) { return ImmutableSortedMultiset.of(e1, e2); }
项目:guava-factory    文件:Factory.java   
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> sortedMultiset(E e1, E e2, E e3) { return ImmutableSortedMultiset.of(e1, e2, e3); }
项目:guava-factory    文件:Factory.java   
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> sortedMultiset(E e1, E e2, E e3, E e4) { return ImmutableSortedMultiset.of(e1, e2, e3, e4); }
项目:guava-factory    文件:Factory.java   
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> sortedMultiset(E e1, E e2, E e3, E e4, E e5) { return ImmutableSortedMultiset.of(e1, e2, e3, e4, e5); }
项目:guava-factory    文件:Factory.java   
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> sortedMultiset(E e1, E e2, E e3, E e4, E e5, E e6, E... others) { return ImmutableSortedMultiset.of(e1, e2, e3, e4, e5, e6, others); }