本文整理汇总了Java中com.google.common.collect.ImmutableSortedMultiset类的典型用法代码示例。如果您正苦于以下问题:Java ImmutableSortedMultiset类的具体用法?Java ImmutableSortedMultiset怎么用?Java ImmutableSortedMultiset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableSortedMultiset类属于com.google.common.collect包,在下文中一共展示了ImmutableSortedMultiset类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resultsMatch
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
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;
}
}
示例2: getResultsComparison
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
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();
}
}
示例3: testToImmutableSortedMultiset
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
@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");
}
示例4: testToImmutableSortedMultisetWithComparator
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
@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");
}
示例5: getElemMultiset
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
@Value.ReverseOrder
ImmutableSortedMultiset<Elem> getElemMultiset();
示例6: getImmutableElemMultiset
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
@Value.ReverseOrder
ImmutableSortedMultiset<ImmutableElem> getImmutableElemMultiset();
示例7: generateImmutableSortedMultiset
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
@Generates private static <E extends Comparable<E>> ImmutableSortedMultiset<E>
generateImmutableSortedMultiset(E freshElement) {
return ImmutableSortedMultiset.of(freshElement);
}
示例8: testImmutableSortedMultiset
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
public void testImmutableSortedMultiset() {
assertFreshInstance(new TypeToken<ImmutableSortedMultiset<String>>() {});
}
示例9: toImmutableSortedMultiset
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
public static <T extends Comparable<T>> Collector<T, ?, ImmutableSortedMultiset<T>> toImmutableSortedMultiset() {
return toImmutableSortedMultiset(Comparator.<T>naturalOrder());
}
示例10: generateImmutableSortedMultiset
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
@Generates
private static <E extends Comparable<E>>
ImmutableSortedMultiset<E> generateImmutableSortedMultiset(E freshElement) {
return ImmutableSortedMultiset.of(freshElement);
}
示例11: VariantAnnotations
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
/**
* 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));
}
示例12: emptySortedMultiset
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
public static <E> ImmutableSortedMultiset<E> emptySortedMultiset() { return ImmutableSortedMultiset.of(); }
示例13: sortedMultiset
import com.google.common.collect.ImmutableSortedMultiset; //导入依赖的package包/类
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> sortedMultiset(E element) { return ImmutableSortedMultiset.of(element); }