当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableSortedSet类代码示例

本文整理汇总了Java中com.google.common.collect.ImmutableSortedSet的典型用法代码示例。如果您正苦于以下问题:Java ImmutableSortedSet类的具体用法?Java ImmutableSortedSet怎么用?Java ImmutableSortedSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImmutableSortedSet类属于com.google.common.collect包,在下文中一共展示了ImmutableSortedSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAddMemberReplicaForShard

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
@Test
public void testAddMemberReplicaForShard() {
    configuration.addMemberReplicaForShard("people-1", MEMBER_2);
    String shardName = configuration.getShardNameForModule("people");
    assertEquals("ModuleShardName", "people-1", shardName);
    ShardStrategy shardStrategy = configuration.getStrategyForModule("people");
    assertEquals("ModuleStrategy", ModuleShardStrategy.class, shardStrategy.getClass());
    Collection<MemberName> members = configuration.getMembersFromShardName("people-1");
    assertEquals("Members", ImmutableSortedSet.of(MEMBER_1, MEMBER_2),
        ImmutableSortedSet.copyOf(members));

    configuration.addMemberReplicaForShard("non-existent", MEMBER_2);
    Set<String> shardNames = configuration.getAllShardNames();
    assertEquals("ShardNames", ImmutableSortedSet.of("people-1", "cars-1", "test-1", "default"),
        ImmutableSortedSet.copyOf(shardNames));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:ConfigurationImplTest.java

示例2: create

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
/**
 * Returns a new {@link CustomFitter} with bounds corresponding to the Fibonacci sequence.
 *
 * @param maxBucketSize the maximum bucket size to create (rounded down to the nearest Fibonacci
 *     number)
 * @throws IllegalArgumentException if {@code maxBucketSize <= 0}
 */
public static CustomFitter create(long maxBucketSize) {
  checkArgument(maxBucketSize > 0, "maxBucketSize must be greater than 0");

  ImmutableSortedSet.Builder<Double> boundaries = ImmutableSortedSet.naturalOrder();
  boundaries.add(Double.valueOf(0));
  long i = 1;
  long j = 2;
  long k = 3;
  while (i <= maxBucketSize) {
    boundaries.add(Double.valueOf(i));
    i = j;
    j = k;
    k = i + j;
  }

  return CustomFitter.create(boundaries.build());
}
 
开发者ID:google,项目名称:java-monitoring-client-library,代码行数:25,代码来源:FibonacciFitter.java

示例3: create

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
/**
 * Create a new {@link ExponentialFitter}.
 *
 * @param numFiniteIntervals the number of intervals, excluding the underflow and overflow
 *     intervals
 * @param base the base of the exponent
 * @param scale a multiplicative factor for the exponential function
 * @throws IllegalArgumentException if {@code numFiniteIntervals <= 0}, {@code width <= 0} or
 *     {@code base <= 1}
 */
public static ExponentialFitter create(int numFiniteIntervals, double base, double scale) {
  checkArgument(numFiniteIntervals > 0, "numFiniteIntervals must be greater than 0");
  checkArgument(scale != 0, "scale must not be 0");
  checkArgument(base > 1, "base must be greater than 1");
  checkDouble(base);
  checkDouble(scale);

  ImmutableSortedSet.Builder<Double> boundaries = ImmutableSortedSet.naturalOrder();

  for (int i = 0; i < numFiniteIntervals + 1; i++) {
    boundaries.add(scale * Math.pow(base, i));
  }

  return new AutoValue_ExponentialFitter(base, scale, boundaries.build());
}
 
开发者ID:google,项目名称:java-monitoring-client-library,代码行数:26,代码来源:ExponentialFitter.java

示例4: toSortedSet

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
@Nonnull
public SortedSet<ImmutableItem> toSortedSet(@Nonnull Comparator<? super ImmutableItem> comparator,
                                            @Nullable final SortedSet<? extends Item> sortedSet) {
    if (sortedSet == null || sortedSet.size() == 0) {
        return ImmutableSortedSet.of();
    }

    @SuppressWarnings("unchecked")
    ImmutableItem[] newItems = (ImmutableItem[])new Object[sortedSet.size()];
    int index = 0;
    for (Item item: sortedSet) {
        newItems[index++] = makeImmutable(item);
    }

    return ArraySortedSet.of(comparator, newItems);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:17,代码来源:ImmutableConverter.java

示例5: testParseHpoHead

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
@Test
public void testParseHpoHead() throws IOException {
  final GoOboParser parser = new GoOboParser(goHeadFile, true);
  final GoOntology ontology = parser.parse();

  assertEquals(
      "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3]]]}, edgeCount=3]",
      ontology.getGraph().toString());
  assertEquals(
      "[ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000004], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005554], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0007582], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008372]]",
      ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString());
  assertThat(ImmutableSortedMap.copyOf(ontology.getTermMap()).toString(),
      startsWith("{ImmutableTermId"));
  assertThat(ImmutableSortedMap.copyOf(ontology.getTermMap()).toString(),
      endsWith("description=null, trailingModifiers=null]]]}"));
  assertEquals(
      "{1=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1, relationQualifier=IS_A], 2=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2, relationQualifier=IS_A], 3=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3, relationQualifier=IS_A]}",
      ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString());
  assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000]",
      ontology.getRootTermId().toString());
  assertEquals(
      "{data-version=releases/2017-06-16, remark=Includes Ontology(OntologyID(OntologyIRI(<http://purl.obolibrary.org/obo/go/never_in_taxon.owl>))) [Axioms: 18 Logical Axioms: 0]}",
      ontology.getMetaInfo().toString());
}
 
开发者ID:Phenomics,项目名称:ontolib,代码行数:25,代码来源:GoOboParserTest.java

示例6: testParseHpoHead

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
@Test
public void testParseHpoHead() throws IOException {
  final MpoOboParser parser = new MpoOboParser(mpoHeadFile, true);
  final MpoOntology ontology = parser.parse();

  assertEquals(
      "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=1]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=3]], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=3]]]}, edgeCount=3]",
      ontology.getGraph().toString());
  assertEquals(
      "[ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000368], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075]]",
      ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString());
  assertEquals(
      "{ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], altTermIds=[], name=mammalian phenotype, definition=the observable morphological, physiological, behavioral and other characteristics of mammalian organisms that are manifested through development and lifespan, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000368]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000368]], name=abnormal coat/hair pigmentation, definition=irregular or unusual pigmentation of the hair, comment=null, subsets=[Europhenome_Terms, IMPC, Sanger_Terms], synonyms=[ImmutableTermSynonym [value=abnormal coat color, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=abnormal hair pigmentation, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=coat: color anomalies, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=MGI:2173541, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], altTermIds=[], name=pigmentation phenotype, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], altTermIds=[], name=hyperpigmentation, definition=excess of pigment in any or all tissues or a part of a tissue, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000368]], name=abnormal coat/hair pigmentation, definition=irregular or unusual pigmentation of the hair, comment=null, subsets=[Europhenome_Terms, IMPC, Sanger_Terms], synonyms=[ImmutableTermSynonym [value=abnormal coat color, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=abnormal hair pigmentation, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=coat: color anomalies, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=MGI:2173541, description=null, trailingModifiers=null]]]}",
      ImmutableSortedMap.copyOf(ontology.getTermMap()).toString());
  assertEquals(
      "{1=MpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=1, relationQualifier=IS_A], 2=MpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=2, relationQualifier=IS_A], 3=MpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=3, relationQualifier=IS_A]}",
      ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString());
  assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]",
      ontology.getRootTermId().toString());
  assertEquals("{data-version=releases/2017-06-05}", ontology.getMetaInfo().toString());
}
 
开发者ID:Phenomics,项目名称:ontolib,代码行数:22,代码来源:MpoOboParserTest.java

示例7: testParseUberphenoHead

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
@Test
public void testParseUberphenoHead() throws IOException {
  final UberphenoOboParser parser = new UberphenoOboParser(uberphenoHeadFile, true);
  final UberphenoOntology ontology = parser.parse();

  assertEquals(
      "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=4]], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=4]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=1], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=3]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=3]]]}, edgeCount=4]",
      ontology.getGraph().toString());
  assertEquals(
      "[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001]]",
      ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString());
  assertEquals(
      "{ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], altTermIds=[], name=All, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], altTermIds=[], name=mammalian phenotype, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], altTermIds=[], name=pigmentation phenotype, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], altTermIds=[], name=UBERPHENO_ROOT, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], altTermIds=[], name=abnormal(ly) quality zebrafish anatomical entity, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]]}",
      ImmutableSortedMap.copyOf(ontology.getTermMap()).toString());
  assertEquals(
      "{1=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=1, relationQualifier=IS_A], 2=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=2, relationQualifier=IS_A], 3=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=3, relationQualifier=IS_A], 4=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=4, relationQualifier=IS_A]}",
      ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString());
  assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001]",
      ontology.getRootTermId().toString());
  assertEquals("{date=20:01:2012 06:00}", ontology.getMetaInfo().toString());
}
 
开发者ID:Phenomics,项目名称:ontolib,代码行数:22,代码来源:UberphenoOboParserTest.java

示例8: testRemoveMemberReplicaForShard

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
@Test
public void testRemoveMemberReplicaForShard() {
    configuration.removeMemberReplicaForShard("default", MEMBER_2);
    String shardName = configuration.getShardNameForModule("default");
    assertEquals("ModuleShardName", "default", shardName);
    ShardStrategy shardStrategy = configuration.getStrategyForModule("default");
    assertNull("ModuleStrategy", shardStrategy);
    Collection<MemberName> members = configuration.getMembersFromShardName("default");
    assertEquals("Members", ImmutableSortedSet.of(MEMBER_1, MEMBER_3),
        ImmutableSortedSet.copyOf(members));

    configuration.removeMemberReplicaForShard("non-existent", MEMBER_2);
    Set<String> shardNames = configuration.getAllShardNames();
    assertEquals("ShardNames", ImmutableSortedSet.of("people-1", "cars-1", "test-1", "default"),
        ImmutableSortedSet.copyOf(shardNames));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:ConfigurationImplTest.java

示例9: initializePropertySources

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
protected void initializePropertySources() {
  if (environment.getPropertySources().contains(APOLLO_PROPERTY_SOURCE_NAME)) {
    //already initialized
    return;
  }
  CompositePropertySource composite = new CompositePropertySource(APOLLO_PROPERTY_SOURCE_NAME);

  //sort by order asc
  ImmutableSortedSet<Integer> orders = ImmutableSortedSet.copyOf(NAMESPACE_NAMES.keySet());
  Iterator<Integer> iterator = orders.iterator();

  while (iterator.hasNext()) {
    int order = iterator.next();
    for (String namespace : NAMESPACE_NAMES.get(order)) {
      Config config = ConfigService.getConfig(namespace);

      composite.addPropertySource(new ConfigPropertySource(namespace, config));
    }
  }
  environment.getPropertySources().addFirst(composite);
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:22,代码来源:PropertySourcesProcessor.java

示例10: maplist

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
@Command(
    aliases = {"maplist", "maps", "ml"},
    desc = "Shows the maps that are currently loaded",
    usage = "[page]",
    min = 0,
    max = 1,
    help = "Shows all the maps that are currently loaded including ones that are not in the rotation."
)
@CommandPermissions("pgm.maplist")
public static void maplist(CommandContext args, final CommandSender sender) throws CommandException {
    final Set<PGMMap> maps = ImmutableSortedSet.copyOf(new PGMMap.DisplayOrder(), PGM.getMatchManager().getMaps());

    new PrettyPaginatedResult<PGMMap>(PGMTranslations.get().t("command.map.mapList.title", sender)) {
        @Override public String format(PGMMap map, int index) {
            return (index + 1) + ". " + map.getInfo().getShortDescription(sender);
        }
    }.display(new BukkitWrappedCommandSender(sender), maps, args.getInteger(0, 1) /* page */);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:19,代码来源:MapCommands.java

示例11: guavaStuff

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
static void guavaStuff() {
  Collection<String> c = null;
  Object o = null;
  // BUG: Diagnostic contains: passing @Nullable parameter 'c' where @NonNull is required
  ImmutableList.builder().addAll(c).build();
  // BUG: Diagnostic contains: passing @Nullable parameter 'o' where @NonNull is required
  ImmutableList.builder().add(o).build();
  // BUG: Diagnostic contains: passing @Nullable parameter 'c' where @NonNull is required
  ImmutableSet.builder().addAll(c).build();
  // BUG: Diagnostic contains: passing @Nullable parameter 'o' where @NonNull is required
  ImmutableSet.builder().add(o).build();
  // BUG: Diagnostic contains: passing @Nullable parameter 'c' where @NonNull is required
  ImmutableSortedSet.builder().addAll(c).build();
  // BUG: Diagnostic contains: passing @Nullable parameter 'o' where @NonNull is required
  ImmutableSortedSet.builder().add(o).build();
  // BUG: Diagnostic contains: passing @Nullable parameter 'c' where @NonNull is required
  Iterables.getFirst(c, "hi");
}
 
开发者ID:uber,项目名称:NullAway,代码行数:19,代码来源:NullAwayNativeModels.java

示例12: reorderedImportsString

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
private String reorderedImportsString(ImmutableSortedSet<Import> imports) {
    assert !imports.isEmpty();

    Import firstImport = imports.iterator().next();

    // Pretend that the first import was preceded by another import of the same kind
    // (static or non-static), so we don't insert a newline there.
    boolean lastWasStatic = firstImport.isStatic;

    StringBuilder sb = new StringBuilder();
    for (Import thisImport : imports) {
        if (lastWasStatic && !thisImport.isStatic) {
            // Blank line between static and non-static imports.
            sb.append(lineSeparator);
        }
        lastWasStatic = thisImport.isStatic;
        sb.append(thisImport);
    }
    return sb.toString();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:21,代码来源:ImportOrderer.java

示例13: ParentChildIndexFieldData

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
public ParentChildIndexFieldData(Index index, Settings indexSettings, MappedFieldType.Names fieldNames,
                                 FieldDataType fieldDataType, IndexFieldDataCache cache, MapperService mapperService,
                                 CircuitBreakerService breakerService) {
    super(index, indexSettings, fieldNames, fieldDataType, cache);
    this.breakerService = breakerService;
    if (Version.indexCreated(indexSettings).before(Version.V_2_0_0_beta1)) {
        parentTypes = new TreeSet<>();
        for (DocumentMapper documentMapper : mapperService.docMappers(false)) {
            beforeCreate(documentMapper);
        }
        mapperService.addTypeListener(this);
    } else {
        ImmutableSortedSet.Builder<String> builder = ImmutableSortedSet.naturalOrder();
        for (DocumentMapper mapper : mapperService.docMappers(false)) {
            ParentFieldMapper parentFieldMapper = mapper.parentFieldMapper();
            if (parentFieldMapper.active()) {
                builder.add(parentFieldMapper.type());
            }
        }
        parentTypes = builder.build();
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:ParentChildIndexFieldData.java

示例14: testParseHpoHead

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
@Test
public void testParseHpoHead() throws IOException {
  final GoOboParser parser = new GoOboParser(goHeadFile, true);
  final GoOntology ontology = parser.parse();

  assertEquals(
      "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3]]]}, edgeCount=3]",
      ontology.getGraph().toString());
  assertEquals(
      "[ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000004], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005554], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0007582], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008372]]",
      ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString());
  assertThat(ImmutableSortedMap.copyOf(ontology.getTermMap()).toString(),
      startsWith("{ImmutableTermId"));
  assertThat(ImmutableSortedMap.copyOf(ontology.getTermMap()).toString(),
      endsWith("createdBy=null, creationDate=null]}"));
  assertEquals(
      "{1=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1, relationQualifier=IS_A], 2=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2, relationQualifier=IS_A], 3=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3, relationQualifier=IS_A]}",
      ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString());
  assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000]",
      ontology.getRootTermId().toString());
  assertEquals(
      "{data-version=releases/2017-06-16, remark=Includes Ontology(OntologyID(OntologyIRI(<http://purl.obolibrary.org/obo/go/never_in_taxon.owl>))) [Axioms: 18 Logical Axioms: 0]}",
      ontology.getMetaInfo().toString());
}
 
开发者ID:johntiger1,项目名称:boqa,代码行数:25,代码来源:GoOboParserTest.java

示例15: readTest

import com.google.common.collect.ImmutableSortedSet; //导入依赖的package包/类
@Test
public void readTest() throws IOException {
  FieldEncryptorConfig expectedConfig = new FieldEncryptorConfigBuilder().setValueEncryptor(ValueEncryptor.AES_CBC).setProvider("SunJCE").setKeyLength(24)
      .setEncryptUsingVisibility(false).setKeyId("keyId").setDestination(EntryField.COLUMN_FAMILY)
      .setSources(ImmutableSortedSet.of(EntryField.ROW, EntryField.COLUMN_QUALIFIER, EntryField.COLUMN_FAMILY)).build();
  FieldEncryptorConfig actualConfig = new FieldEncryptorConfigBuilder().readFromIni(getIni("config1.ini").get(EntryField.COLUMN_FAMILY.toString())).build();
  assertThat("reading the ini file produces the correct configuration", actualConfig, hasSameFieldsAs(expectedConfig));

  expectedConfig = new FieldEncryptorConfigBuilder().setValueEncryptor(ValueEncryptor.AES_CBC).setProvider("BC").setKeyLength(16)
      .setEncryptUsingVisibility(true).setKeyId("AES_CBC").setDestination(EntryField.ROW).setSources(ImmutableSortedSet.of(EntryField.ROW)).build();
  actualConfig = new FieldEncryptorConfigBuilder().readFromIni(getIni("config2.ini").get(EntryField.ROW.toString())).build();
  assertThat("reading the ini file produces the correct configuration", actualConfig, hasSameFieldsAs(expectedConfig));

  expectedConfig = new FieldEncryptorConfigBuilder().setValueEncryptor(ValueEncryptor.AES_CBC).setKeyLength(16).setEncryptUsingVisibility(true)
      .setKeyId("AES_CBC").setDestination(EntryField.ROW).setSources(ImmutableSortedSet.of(EntryField.ROW)).build();
  actualConfig = new FieldEncryptorConfigBuilder().readFromIni(getIni("config2WithoutDefaults.ini").get(EntryField.ROW.toString())).build();
  assertThat("default values are correctly set", actualConfig, hasSameFieldsAs(expectedConfig));

  expectedConfig = new FieldEncryptorConfigBuilder().setValueEncryptor(ValueEncryptor.AES_CBC).setProvider(null).setKeyLength(16)
      .setEncryptUsingVisibility(false).setKeyId(ValueEncryptor.AES_CBC.toString()).setDestination(EntryField.VALUE)
      .setSources(ImmutableSortedSet.of(EntryField.VALUE)).build();
  actualConfig = new FieldEncryptorConfigBuilder().readFromIni(getIni("config3.ini").get(EntryField.VALUE.toString())).build();
  assertThat("reading the ini file produces the correct configuration", actualConfig, hasSameFieldsAs(expectedConfig));
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:25,代码来源:FieldEncryptorConfigTest.java


注:本文中的com.google.common.collect.ImmutableSortedSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。