Example usage for org.apache.commons.collections.bag TreeBag TreeBag

List of usage examples for org.apache.commons.collections.bag TreeBag TreeBag

Introduction

In this page you can find the example usage for org.apache.commons.collections.bag TreeBag TreeBag.

Prototype

public TreeBag() 

Source Link

Document

Constructs an empty TreeBag.

Usage

From source file:org.sonar.api.measures.CountDistributionBuilder.java

/**
 * Creates an empty CountDistributionBuilder for a specified metric
 *
 * @param metric the metric/*from  w w w  .  ja  v a2  s.co m*/
 */
public CountDistributionBuilder(Metric metric) {
    setMetric(metric);
    this.countBag = new TreeBag();
}

From source file:org.sonar.api.measures.RangeDistributionBuilder.java

private void init(Number[] bottomLimits) {
    this.bottomLimits = new Number[bottomLimits.length];
    System.arraycopy(bottomLimits, 0, this.bottomLimits, 0, this.bottomLimits.length);
    Arrays.sort(this.bottomLimits);
    changeDoublesToInts();/* ww w .j  a  v a 2 s .co m*/
    countBag = TransformedSortedBag.decorate(new TreeBag(), new RangeTransformer());
    doClear();
}

From source file:org.sonar.api.utils.DeprecatedKeyValueFormatTest.java

@Test
public void formatBag() {
    TreeBag bag = new TreeBag();
    bag.add("hello", 1);
    bag.add("key", 3);
    assertThat(KeyValueFormat.format(bag), is("hello=1;key=3"));
}

From source file:org.sonar.api.utils.DeprecatedKeyValueFormatTest.java

@Test
public void formatBagWithVariationHack() {
    TreeBag bag = new TreeBag();
    bag.add("hello", 1);
    bag.add("key", 3);
    assertThat(KeyValueFormat.format(bag, -1), is("hello=0;key=2"));
}

From source file:org.sonar.api.utils.KeyValueFormatTest.java

@Test
public void formatBag() {
    TreeBag bag = new TreeBag();
    bag.add("hello", 1);
    bag.add("key", 3);
    assertThat(KeyValueFormat.format(bag, 0)).isEqualTo("hello=1;key=3");
}

From source file:org.sonar.api.utils.KeyValueFormatTest.java

@Test
public void formatBagWithVariationHack() {
    TreeBag bag = new TreeBag();
    bag.add("hello", 1);
    bag.add("key", 3);
    assertThat(KeyValueFormat.format(bag, -1)).isEqualTo("hello=0;key=2");
}