Java Code Examples for java.util.NavigableSet#addAll()

The following examples show how to use java.util.NavigableSet#addAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DistributionStatisticConfig.java    From micrometer with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: GreedyPipelineFuser.java    From beam with Apache License 2.0 6 votes vote down vote up
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()));
}
 
Example 3
Source File: Track.java    From systemsgenetics with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: FeatureTree.java    From systemsgenetics with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 5
Source File: ConcurrentSkipListSubSetTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 6
Source File: ConcurrentSkipListSubSetJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 7
Source File: TreeSubSetTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 8
Source File: ConcurrentSkipListSubSetJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 9
Source File: ConcurrentSkipListSubSetJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * addAll(null) throws NPE
 */
public void testDescendingAddAll1() {
    try {
        NavigableSet q = dset0();
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 10
Source File: ConcurrentSkipListSubSetTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 11
Source File: ConcurrentSkipListSubSetJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 12
Source File: ConcurrentSkipListSubSetTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * addAll(null) throws NPE
 */
public void testAddAll1() {
    NavigableSet q = set0();
    try {
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 13
Source File: ConcurrentSkipListSubSetTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 14
Source File: BTreeSet2Test.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * addAll(null) throws NPE
 */
public void testAddAll1() {
    try {
        NavigableSet q = newNavigableSet();
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 15
Source File: TreeSubSetTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * addAll(null) throws NPE
 */
public void testAddAll1() {
    NavigableSet q = set0();
    try {
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 16
Source File: BTreeSet2Test.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 17
Source File: ConcurrentSkipListSubSetJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 18
Source File: BTreeMapSubSetTest.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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) {}
}
 
Example 19
Source File: TimeWindowFixedBoundaryHistogram.java    From micrometer with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 20
Source File: Chooser.java    From sensordatacollector with GNU General Public License v2.0 4 votes vote down vote up
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);
        }
    });
}