當前位置: 首頁>>代碼示例>>Java>>正文


Java SortedSetMultimap類代碼示例

本文整理匯總了Java中com.google.common.collect.SortedSetMultimap的典型用法代碼示例。如果您正苦於以下問題:Java SortedSetMultimap類的具體用法?Java SortedSetMultimap怎麽用?Java SortedSetMultimap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SortedSetMultimap類屬於com.google.common.collect包,在下文中一共展示了SortedSetMultimap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: build

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
public ColumnFilter build()
{
    boolean isFetchAll = metadata != null;

    PartitionColumns queried = queriedBuilder == null ? null : queriedBuilder.build();
    // It's only ok to have queried == null in ColumnFilter if isFetchAll. So deal with the case of a selectionBuilder
    // with nothing selected (we can at least happen on some backward compatible queries - CASSANDRA-10471).
    if (!isFetchAll && queried == null)
        queried = PartitionColumns.NONE;

    SortedSetMultimap<ColumnIdentifier, ColumnSubselection> s = null;
    if (subSelections != null)
    {
        s = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(), Comparator.<ColumnSubselection>naturalOrder());
        for (ColumnSubselection subSelection : subSelections)
            s.put(subSelection.column().name, subSelection);
    }

    return new ColumnFilter(isFetchAll, metadata, queried, s);
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:21,代碼來源:ColumnFilter.java

示例2: potentialMatchersInOrder

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
private static <R> Stream<Matcher<R>> potentialMatchersInOrder(
        List<Matcher<R>> cases,
        SortedSetMultimap<Class<?>, Indexed<Matcher<R>>> matchersByScopeType,
        Object object
) {
    if (object == null) {
        return cases.stream();
    } else {
        Stream<Class<?>> supertypes = Util.supertypes(object.getClass());
        TreeSet<Indexed<Matcher<R>>> indexedMatchersInOrder = supertypes
                .flatMap(type -> matchersByScopeType.get(type).stream())
                .collect(toCollection(TreeSet::new));
        return indexedMatchersInOrder.stream()
                .map(Indexed::value);
    }
}
 
開發者ID:matchmaker,項目名稱:matchmaker,代碼行數:17,代碼來源:MultiMatcherMatchFunctions.java

示例3: prettyPrintRequiredGroups

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
/**
 * Output the requirement groups that the property is a member of, including all properties that
 * satisfy the group requirement, breaking up long lines on white space characters and attempting
 * to honor a line limit of {@code TERMINAL_WIDTH}.
 */
private static void prettyPrintRequiredGroups(PrintStream out, Required annotation,
    SortedSetMultimap<String, String> requiredGroupNameToProperties) {
  if (annotation == null || annotation.groups() == null) {
    return;
  }
  for (String group : annotation.groups()) {
    SortedSet<String> groupMembers = requiredGroupNameToProperties.get(group);
    String requirement;
    if (groupMembers.size() == 1) {
      requirement = Iterables.getOnlyElement(groupMembers) + " is required.";
    } else {
      requirement = "At least one of " + groupMembers + " is required";
    }
    terminalPrettyPrint(out, requirement.split("\\s+"));
  }
}
 
開發者ID:apache,項目名稱:beam,代碼行數:22,代碼來源:PipelineOptionsFactory.java

示例4: validateMethodAnnotations

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
/**
 * Validates that a given class conforms to the following properties:
 * <ul>
 *   <li>Only getters may be annotated with {@link JsonIgnore @JsonIgnore}.
 *   <li>If any getter is annotated with {@link JsonIgnore @JsonIgnore}, then all getters for
 *       this property must be annotated with {@link JsonIgnore @JsonIgnore}.
 * </ul>
 *
 * @param allInterfaceMethods All interface methods that derive from {@link PipelineOptions}.
 * @param descriptors The list of {@link PropertyDescriptor}s representing all valid bean
 * properties of {@code iface}.
 */
private static void validateMethodAnnotations(
    SortedSet<Method> allInterfaceMethods,
    List<PropertyDescriptor> descriptors) {
  SortedSetMultimap<Method, Method> methodNameToAllMethodMap =
      TreeMultimap.create(MethodNameComparator.INSTANCE, MethodComparator.INSTANCE);
  for (Method method : allInterfaceMethods) {
    methodNameToAllMethodMap.put(method, method);
  }

  // Verify that there is no getter with a mixed @JsonIgnore annotation.
  validateGettersHaveConsistentAnnotation(
      methodNameToAllMethodMap, descriptors, AnnotationPredicates.JSON_IGNORE);

  // Verify that there is no getter with a mixed @Default annotation.
  validateGettersHaveConsistentAnnotation(
      methodNameToAllMethodMap, descriptors, AnnotationPredicates.DEFAULT_VALUE);

  // Verify that no setter has @JsonIgnore.
  validateSettersDoNotHaveAnnotation(
      methodNameToAllMethodMap, descriptors, AnnotationPredicates.JSON_IGNORE);

  // Verify that no setter has @Default.
  validateSettersDoNotHaveAnnotation(
      methodNameToAllMethodMap, descriptors, AnnotationPredicates.DEFAULT_VALUE);
}
 
開發者ID:apache,項目名稱:beam,代碼行數:38,代碼來源:PipelineOptionsFactory.java

示例5: mergeCommitWhereOneParentHasExistingGroup

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
@Test
public void mergeCommitWhereOneParentHasExistingGroup() throws Exception {
  RevCommit branchTip = tr.commit().create();
  RevCommit a = tr.commit().parent(branchTip).create();
  RevCommit b = tr.commit().parent(branchTip).create();
  RevCommit m = tr.commit().parent(a).parent(b).create();

  String group = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
  SortedSetMultimap<ObjectId, String> groups =
      collectGroups(
          newWalk(m, branchTip), patchSets().put(b, psId(1, 1)), groups().put(psId(1, 1), group));

  // Merge commit and other parent get the existing group.
  assertThat(groups).containsEntry(a, group);
  assertThat(groups).containsEntry(b, group);
  assertThat(groups).containsEntry(m, group);
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:18,代碼來源:GroupCollectorTest.java

示例6: mergeCommitWhereBothParentsHaveDifferentGroups

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
@Test
public void mergeCommitWhereBothParentsHaveDifferentGroups() throws Exception {
  RevCommit branchTip = tr.commit().create();
  RevCommit a = tr.commit().parent(branchTip).create();
  RevCommit b = tr.commit().parent(branchTip).create();
  RevCommit m = tr.commit().parent(a).parent(b).create();

  String group1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
  String group2 = "1234567812345678123456781234567812345678";
  SortedSetMultimap<ObjectId, String> groups =
      collectGroups(
          newWalk(m, branchTip),
          patchSets().put(a, psId(1, 1)).put(b, psId(2, 1)),
          groups().put(psId(1, 1), group1).put(psId(2, 1), group2));

  assertThat(groups).containsEntry(a, group1);
  assertThat(groups).containsEntry(b, group2);
  // Merge commit gets joined group of parents.
  assertThat(groups.asMap()).containsEntry(m, ImmutableSet.of(group1, group2));
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:21,代碼來源:GroupCollectorTest.java

示例7: mergeCommitMergesGroupsFromParent

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
@Test
public void mergeCommitMergesGroupsFromParent() throws Exception {
  RevCommit branchTip = tr.commit().create();
  RevCommit a = tr.commit().parent(branchTip).create();
  RevCommit b = tr.commit().parent(branchTip).create();
  RevCommit m = tr.commit().parent(a).parent(b).create();

  String group1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
  String group2a = "1234567812345678123456781234567812345678";
  String group2b = "ef123456ef123456ef123456ef123456ef123456";
  SortedSetMultimap<ObjectId, String> groups =
      collectGroups(
          newWalk(m, branchTip),
          patchSets().put(a, psId(1, 1)).put(b, psId(2, 1)),
          groups().put(psId(1, 1), group1).put(psId(2, 1), group2a).put(psId(2, 1), group2b));

  assertThat(groups).containsEntry(a, group1);
  assertThat(groups.asMap()).containsEntry(b, ImmutableSet.of(group2a, group2b));
  // Joined parent groups are split and resorted.
  assertThat(groups.asMap()).containsEntry(m, ImmutableSet.of(group1, group2a, group2b));
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:22,代碼來源:GroupCollectorTest.java

示例8: multipleMergeCommitsInHistoryAllResolveToSameGroup

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
@Test
public void multipleMergeCommitsInHistoryAllResolveToSameGroup() throws Exception {
  RevCommit branchTip = tr.commit().create();
  RevCommit a = tr.commit().parent(branchTip).create();
  RevCommit b = tr.commit().parent(branchTip).create();
  RevCommit c = tr.commit().parent(branchTip).create();
  RevCommit m1 = tr.commit().parent(b).parent(c).create();
  RevCommit m2 = tr.commit().parent(a).parent(m1).create();

  SortedSetMultimap<ObjectId, String> groups =
      collectGroups(newWalk(m2, branchTip), patchSets(), groups());

  assertThat(groups).containsEntry(a, a.name());
  assertThat(groups).containsEntry(b, a.name());
  assertThat(groups).containsEntry(c, a.name());
  assertThat(groups).containsEntry(m1, a.name());
  assertThat(groups).containsEntry(m2, a.name());
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:19,代碼來源:GroupCollectorTest.java

示例9: mergeCommitWithOneNewParentAndTwoExistingPatchSets

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
@Test
public void mergeCommitWithOneNewParentAndTwoExistingPatchSets() throws Exception {
  RevCommit branchTip = tr.commit().create();
  RevCommit a = tr.commit().parent(branchTip).create();
  RevCommit b = tr.commit().parent(branchTip).create();
  RevCommit c = tr.commit().parent(b).create();
  RevCommit m = tr.commit().parent(a).parent(c).create();

  String group1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
  String group2 = "1234567812345678123456781234567812345678";
  SortedSetMultimap<ObjectId, String> groups =
      collectGroups(
          newWalk(m, branchTip),
          patchSets().put(a, psId(1, 1)).put(b, psId(2, 1)),
          groups().put(psId(1, 1), group1).put(psId(2, 1), group2));

  assertThat(groups).containsEntry(a, group1);
  assertThat(groups).containsEntry(b, group2);
  assertThat(groups).containsEntry(c, group2);
  assertThat(groups.asMap()).containsEntry(m, ImmutableSet.of(group1, group2));
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:22,代碼來源:GroupCollectorTest.java

示例10: initializeFromV1Offsets

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
public Set<String> initializeFromV1Offsets(Map<String, String> offsets) throws StageException {
  // v1 offsets map qualified table names to offset column positions
  LOG.info("Upgrading offsets from v1 to v2; logging current offsets now");
  offsets.forEach((t, v) -> LOG.info("{} -> {}", t, v));

  final Set<String> offsetKeysToRemove = new HashSet<>();
  SortedSetMultimap<TableContext, TableRuntimeContext> v1Offsets = TableRuntimeContext.initializeAndUpgradeFromV1Offsets(
      tableContextMap,
      offsets,
      offsetKeysToRemove
  );
  generateInitialPartitionsInSharedQueue(true, v1Offsets, null);

  initializeMaxPartitionWithDataPerTable(offsets);
  return offsetKeysToRemove;
}
 
開發者ID:streamsets,項目名稱:datacollector,代碼行數:17,代碼來源:MultithreadedTableProvider.java

示例11: build

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
public ColumnFilter build()
{
    boolean isFetchAll = metadata != null;

    PartitionColumns selectedColumns = selection == null ? null : selection.build();
    // It's only ok to have selection == null in ColumnFilter if isFetchAll. So deal with the case of a "selection" builder
    // with nothing selected (we can at least happen on some backward compatible queries - CASSANDRA-10471).
    if (!isFetchAll && selectedColumns == null)
        selectedColumns = PartitionColumns.NONE;

    SortedSetMultimap<ColumnIdentifier, ColumnSubselection> s = null;
    if (subSelections != null)
    {
        s = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(), Comparator.<ColumnSubselection>naturalOrder());
        for (ColumnSubselection subSelection : subSelections)
            s.put(subSelection.column().name, subSelection);
    }

    return new ColumnFilter(isFetchAll, metadata, selectedColumns, s);
}
 
開發者ID:scylladb,項目名稱:scylla-tools-java,代碼行數:21,代碼來源:ColumnFilter.java

示例12: getRecipesWithoutIngredient

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
public SortedSetMultimap<Integer, String> getRecipesWithoutIngredient(String ingredient) throws SQLException {
    SortedSetMultimap<Integer, String> recipes = TreeMultimap.create(new InvertedComparator<Integer>(),
            new InvertedComparator<String>());
    PreparedStatement pStatement = connection.prepareStatement(
            "SELECT gerichte2.name, COUNT(schmeckt.users_id) AS schmecktcount FROM gerichte AS gerichte2 " +
                    "LEFT JOIN schmeckt ON gerichte2.name = schmeckt.gerichte_name " +
                    "WHERE gerichte2.name NOT IN (" +
                    "SELECT gerichte.name FROM gerichte " +
                    "INNER JOIN versions ON gerichte.name = versions.gerichte_name AND gerichte.active_id = versions.id " +
                    "INNER JOIN versions_has_zutaten ON versions.gerichte_name = versions_gerichte_name AND id = versions_id " +
                    "WHERE zutaten_name = ?) " +
                    "GROUP BY gerichte2.name");
    pStatement.setString(1, ingredient);
    try (ResultSet data = pStatement.executeQuery()) {
        while (data.next())
            recipes.put(data.getInt("schmecktcount"), data.getString("gerichte2.name"));
    }

    return recipes;
}
 
開發者ID:anycook,項目名稱:anycook-api,代碼行數:21,代碼來源:DBSearch.java

示例13: ColumnFilter

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
private ColumnFilter(boolean isFetchAll,
                     CFMetaData metadata,
                     PartitionColumns queried,
                     SortedSetMultimap<ColumnIdentifier, ColumnSubselection> subSelections)
{
    assert !isFetchAll || metadata != null;
    assert isFetchAll || queried != null;
    this.isFetchAll = isFetchAll;
    this.metadata = metadata;
    this.queried = queried;
    this.subSelections = subSelections;
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:13,代碼來源:ColumnFilter.java

示例14: deserialize

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
public ColumnFilter deserialize(DataInputPlus in, int version, CFMetaData metadata) throws IOException
{
    int header = in.readUnsignedByte();
    boolean isFetchAll = (header & IS_FETCH_ALL_MASK) != 0;
    boolean hasQueried = (header & HAS_QUERIED_MASK) != 0;
    boolean hasSubSelections = (header & HAS_SUB_SELECTIONS_MASK) != 0;

    PartitionColumns queried = null;
    if (hasQueried)
    {
        Columns statics = Columns.serializer.deserialize(in, metadata);
        Columns regulars = Columns.serializer.deserialize(in, metadata);
        queried = new PartitionColumns(statics, regulars);
    }

    SortedSetMultimap<ColumnIdentifier, ColumnSubselection> subSelections = null;
    if (hasSubSelections)
    {
        subSelections = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(), Comparator.<ColumnSubselection>naturalOrder());
        int size = (int)in.readUnsignedVInt();
        for (int i = 0; i < size; i++)
        {
            ColumnSubselection subSel = ColumnSubselection.serializer.deserialize(in, version, metadata);
            subSelections.put(subSel.column().name, subSel);
        }
    }

    return new ColumnFilter(isFetchAll, isFetchAll ? metadata : null, queried, subSelections);
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:30,代碼來源:ColumnFilter.java

示例15: getHistogram

import com.google.common.collect.SortedSetMultimap; //導入依賴的package包/類
/** Creates a histogram of the given collections */
static public <E extends Comparable<E>, T extends Comparable<T>> Multimap<T, E> getHistogram(Collection<E> elems,
		Function<E, T> pivot) {

	final SortedSetMultimap<T, E> histogram = TreeMultimap.create();
	for (E elem : elems) {
		T t = pivot.apply(elem);
		histogram.put(t, elem);
	}
	return histogram;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:12,代碼來源:ReportUtils.java


注:本文中的com.google.common.collect.SortedSetMultimap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。