java.util.NavigableSet# addAll ( ) 源码实例Demo

下面列出了java.util.NavigableSet# addAll ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。


/**
 * For internal use only.
 *
 * @param supportsAggregablePercentiles whether it supports aggregable percentiles
 * @return histogram buckets
 */
public NavigableSet<Double> getHistogramBuckets(boolean supportsAggregablePercentiles) {
    NavigableSet<Double> buckets = new TreeSet<>();

    if (percentileHistogram != null && percentileHistogram && supportsAggregablePercentiles) {
        buckets.addAll(PercentileHistogramBuckets.buckets(this));
        buckets.add(minimumExpectedValue);
        buckets.add(maximumExpectedValue);
    }

    if (serviceLevelObjectives != null) {
        for (double slaBoundary : serviceLevelObjectives) {
            buckets.add(slaBoundary);
        }
    }

    return buckets;
}
 
源代码2 项目: systemsgenetics   文件: FeatureTree.java

public NavigableSet<Feature> getFeatureSet(Chromosome chr, int start, int end) {
	Feature left = new Feature();
	Feature right = new Feature();
	left.setChromosome(chr);
	left.setStart(start);
	left.setStop(start);
	left.setStrand(Strand.POS);
	right.setChromosome(chr);
	right.setStart(end);
	right.setStop(end);
	right.setStrand(Strand.POS);

	NavigableSet<Feature> set = this.treeSet.subSet(left, true, right, true);
	left.setStrand(Strand.NEG);
	right.setStrand(Strand.NEG);
	set.addAll(this.treeSet.subSet(left, true, right, true));

	left.setStrand(Strand.NA);
	right.setStrand(Strand.NA);
	set.addAll(this.treeSet.subSet(left, true, right, true));
	return set;
}
 
源代码3 项目: systemsgenetics   文件: Track.java

public NavigableSet<Feature> getFeatureSet(Chromosome chr, int start, int end) {
	Feature left = new Feature();
	Feature right = new Feature();
	left.setChromosome(chr);
	left.setStart(start);
	left.setStop(start);
	left.setStrand(Strand.POS);
	right.setChromosome(chr);
	right.setStart(end);
	right.setStop(end);
	right.setStrand(Strand.POS);

	NavigableSet<Feature> set = this.features.subSet(left, true, right, true);


	left.setStrand(Strand.NEG);
	right.setStrand(Strand.NEG);
	set.addAll(this.features.subSet(left, true, right, true));

	left.setStrand(Strand.NA);
	right.setStrand(Strand.NA);
	set.addAll(this.features.subSet(left, true, right, true));
	return set;
}
 
源代码4 项目: beam   文件: GreedyPipelineFuser.java

private GreedyPipelineFuser(Pipeline p) {
  // Validate that the original pipeline is well-formed.
  PipelineValidator.validate(p);
  this.pipeline = QueryablePipeline.forPrimitivesIn(p.getComponents());
  Set<PTransformNode> unfusedRootNodes = new LinkedHashSet<>();
  NavigableSet<CollectionConsumer> rootConsumers = new TreeSet<>();
  for (PTransformNode pTransformNode : pipeline.getRootTransforms()) {
    // This will usually be a single node, the downstream of an Impulse, but may be of any size
    DescendantConsumers descendants = getRootConsumers(pTransformNode);
    unfusedRootNodes.addAll(descendants.getUnfusedNodes());
    rootConsumers.addAll(descendants.getFusibleConsumers());
  }
  this.fusedPipeline =
      fusePipeline(
          unfusedRootNodes,
          groupSiblings(rootConsumers),
          ImmutableSet.copyOf(p.getRequirementsList()));
}
 

public TimeWindowFixedBoundaryHistogram(Clock clock, DistributionStatisticConfig config, boolean supportsAggregablePercentiles) {
    super(clock, config, FixedBoundaryHistogram.class, supportsAggregablePercentiles);

    NavigableSet<Double> histogramBuckets = distributionStatisticConfig.getHistogramBuckets(supportsAggregablePercentiles);

    Boolean percentileHistogram = distributionStatisticConfig.isPercentileHistogram();
    if (percentileHistogram != null && percentileHistogram) {
        histogramBuckets.addAll(PercentileHistogramBuckets.buckets(distributionStatisticConfig));
    }

    this.buckets = histogramBuckets.stream().filter(Objects::nonNull).mapToDouble(Double::doubleValue).toArray();
    initRingBuffer();
}
 
源代码6 项目: j2objc   文件: TreeSubSetTest.java

/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testAddAll3() {
    NavigableSet q = set0();
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE - 1; ++i)
        ints[i] = new Integer(i + SIZE);
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 

/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testAddAll3() {
    NavigableSet q = set0();
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE - 1; ++i)
        ints[i] = new Integer(i + SIZE);
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 

/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testDescendingAddAll3() {
    try {
        NavigableSet q = dset0();
        Integer[] ints = new Integer[SIZE];
        for (int i = 0; i < SIZE-1; ++i)
            ints[i] = new Integer(i+SIZE);
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 

/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testAddAll3() {
    try {
        NavigableSet q = set0();
        Integer[] ints = new Integer[SIZE];
        for (int i = 0; i < SIZE-1; ++i)
            ints[i] = new Integer(i+SIZE);
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 

/**
 * addAll(null) throws NPE
 */
public void testDescendingAddAll1() {
    try {
        NavigableSet q = dset0();
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 

/**
 * addAll of a collection with null elements throws NPE
 */
public void testAddAll2() {
    NavigableSet q = set0();
    Integer[] ints = new Integer[SIZE];
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 

/**
 * addAll of a collection with null elements throws NPE
 */
public void testDescendingAddAll2() {
    try {
        NavigableSet q = dset0();
        Integer[] ints = new Integer[SIZE];
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 

/**
 * addAll(null) throws NPE
 */
public void testAddAll1() {
    NavigableSet q = set0();
    try {
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 

/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testDescendingAddAll3() {
    NavigableSet q = dset0();
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE - 1; ++i)
        ints[i] = new Integer(i + SIZE);
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
源代码15 项目: scava   文件: BTreeSet2Test.java

/**
 * addAll(null) throws NPE
 */
public void testAddAll1() {
    try {
        NavigableSet q = newNavigableSet();
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
源代码16 项目: j2objc   文件: TreeSubSetTest.java

/**
 * addAll(null) throws NPE
 */
public void testAddAll1() {
    NavigableSet q = set0();
    try {
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
源代码17 项目: scava   文件: BTreeSet2Test.java

/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testAddAll3() {
    try {
        NavigableSet q = newNavigableSet();
        Integer[] ints = new Integer[SIZE];
        for (int i = 0; i < SIZE-1; ++i)
            ints[i] = new Integer(i);
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 

/**
 * addAll of a collection with null elements throws NPE
 */
public void testDescendingAddAll2() {
    try {
        NavigableSet q = dset0();
        Integer[] ints = new Integer[SIZE];
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
源代码19 项目: scava   文件: BTreeMapSubSetTest.java

/**
 * addAll of a collection with null elements throws NPE
 */
public void testAddAll2() {
    try {
        NavigableSet q = set0();
        Integer[] ints = new Integer[SIZE];
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
源代码20 项目: sensordatacollector   文件: Chooser.java

public void createPositionList(final String s)
{
    // process data
    final NavigableSet<String> data = new TreeSet<>();
    data.addAll(Arrays.asList(s.split("\n")));

    // refresh UI
    runOnUiThread(new Runnable()
    {
        @Override
        public void run()
        {
            // data
            List<String> postures = new ArrayList<>(data);
            MainActivity main = (MainActivity) ActivityController.getInstance().get("MainActivity");
            String selectedElement = ((TextView) main.findViewById(R.id.posture_position)).getText().toString();
            selectedElement = selectedElement.substring(1, selectedElement.length() - 1);
            int pos = Utils.getPosition(selectedElement, postures);

            // set current element
            Chooser.this.adapterPosition.setSelectedElements(Arrays.asList(selectedElement));

            // progressbar
            ProgressBar pb = (ProgressBar) findViewById(R.id.progressBar1);
            pb.setVisibility(View.INVISIBLE);

            // view
            TextView tv = (TextView) findViewById(R.id.posture_posture_headline);
            tv.setText(R.string.position_headline);

            // update adapter
            Chooser.this.adapterPosition.update(null, new ArrayList<>(data));
            Chooser.this.adapterPosition.notifyDataSetChanged();

            // update view
            WearableListView view = (WearableListView) findViewById(R.id.posture_posture_list);
            view.setAdapter(Chooser.this.adapterPosition);
            view.setClickListener(new PositionClickListener());
            view.scrollToPosition(pos);
        }
    });
}