Package org.eobjects.analyzer.beans.valuedist

Examples of org.eobjects.analyzer.beans.valuedist.ValueCountListImpl


public class ValueDistributionResultSwingRendererGroupDelegateTest extends TestCase {

  private InputColumn<String> column = new MockInputColumn<String>("col", String.class);

  public void testNoGrouping() throws Exception {
    ValueCountListImpl topValueCount = ValueCountListImpl.createFullList();
    for (int i = 0; i < 40; i++) {
      // 40 values with unique counts
      topValueCount.register(new ValueCount("v" + i, i + 1));
    }

    ValueDistributionResultSwingRendererGroupDelegate r = new ValueDistributionResultSwingRendererGroupDelegate("foo",
        50, 60);
    r.renderGroupResult(new ValueDistributionGroupResult(column.getName(), topValueCount, null, 0, 0, 0, 0));
View Full Code Here


    assertTrue(r.getGroups().isEmpty());
    assertEquals(40, r.getDataset().getItemCount());
  }

  public void testGroupEverythingOrNothing() throws Exception {
    ValueCountListImpl topValueCount = ValueCountListImpl.createFullList();

    topValueCount.register(new ValueCount("a", 2));
    topValueCount.register(new ValueCount("b", 2));
    topValueCount.register(new ValueCount("c", 2));
    topValueCount.register(new ValueCount("d", 2));
    topValueCount.register(new ValueCount("e", 2));
    topValueCount.register(new ValueCount("f", 3));
    topValueCount.register(new ValueCount("g", 3));
    topValueCount.register(new ValueCount("h", 3));
    topValueCount.register(new ValueCount("i", 4));
    topValueCount.register(new ValueCount("j", 4));
    topValueCount.register(new ValueCount("k", 4));
    topValueCount.register(new ValueCount("l", 4));
    topValueCount.register(new ValueCount("m", 5));
    topValueCount.register(new ValueCount("n", 5));
    topValueCount.register(new ValueCount("o", 6));
    topValueCount.register(new ValueCount("p", 6));
    topValueCount.register(new ValueCount("q", 7));
    topValueCount.register(new ValueCount("r", 7));
    topValueCount.register(new ValueCount("s", 8));
    topValueCount.register(new ValueCount("t", 8));
    topValueCount.register(new ValueCount("u", 9));
    topValueCount.register(new ValueCount("v", 9));

    // even though it is not nescesary for the slice threshold to group
    // these 4 values, we do so for the sake of "grouping consistency"
    // (because they all have count=9).
    topValueCount.register(new ValueCount("hi", 10));
    topValueCount.register(new ValueCount("hello", 10));
    topValueCount.register(new ValueCount("howdy", 10));
    topValueCount.register(new ValueCount("mjellow", 10));

    // preferred size is 13, which would earlier on mean that all the 4
    // values above could be individually included in the dataset.
    ValueDistributionResultSwingRendererGroupDelegate r = new ValueDistributionResultSwingRendererGroupDelegate("foo",
        13, 100);
View Full Code Here

    assertTrue(groups.containsKey("<count=9>"));
    assertTrue(groups.containsKey("<count=10>"));
  }

  public void testPreferredSizeGrouping() throws Exception {
    ValueCountListImpl topValueCount = ValueCountListImpl.createFullList();
    for (int i = 0; i < 2000; i++) {
      // 2000 values but with only 10 different counts - should yield 10
      // groups
      topValueCount.register(new ValueCount("v" + i, 2 + (int) (Math.random() * 10)));
    }

    ValueDistributionResultSwingRendererGroupDelegate r = new ValueDistributionResultSwingRendererGroupDelegate("foo",
        17, 20);
    r.renderGroupResult(new ValueDistributionGroupResult("foo", topValueCount, null, 0, 0, 0, 0));
View Full Code Here

      assertTrue(groupName.startsWith("<count="));
    }
  }

  public void testMaxSizeGrouping() throws Exception {
    ValueCountListImpl topValueCount = ValueCountListImpl.createFullList();
    for (int i = 0; i < 5000; i++) {
      // 5000 values with 10 different counts
      topValueCount.register(new ValueCount("v" + i, 2 + (int) (Math.random() * 10)));
    }

    // 10 additional values that will be grouped in 3 range-groups
    topValueCount.register(new ValueCount("r1", 100));
    topValueCount.register(new ValueCount("r2", 110));
    topValueCount.register(new ValueCount("r3", 130));
    topValueCount.register(new ValueCount("r4", 160));
    topValueCount.register(new ValueCount("r5", 210));
    topValueCount.register(new ValueCount("r6", 340));
    topValueCount.register(new ValueCount("r7", 520));
    topValueCount.register(new ValueCount("r8", 525));
    topValueCount.register(new ValueCount("r9", 530));

    ValueDistributionResultSwingRendererGroupDelegate r = new ValueDistributionResultSwingRendererGroupDelegate("foo",
        10, 13);
    r.renderGroupResult(new ValueDistributionGroupResult("foo", topValueCount, null, 0, 0, 0, 0));

View Full Code Here

TOP

Related Classes of org.eobjects.analyzer.beans.valuedist.ValueCountListImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.