CloneSet 13

# CloneSet13

Previous CloneSet | Next CloneSet | Back to Main Report

Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length]
--- | --- | --- | --- | ---
121 | 2 | 1 | 0.988 | class_body_declarations[9]

Clone Abstraction | Parameter Bindings

Clone Instance (Click to see clone) | Line Count | Source Line | Source File
--- | --- | --- | ---

1

121

185

    E:/TSE/Projects-CloneDR/jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XIntervalSeriesTests.java

2

121

184

    E:/TSE/Projects-CloneDR/jfreechart-1.0.10/tests/org/jfree/data/xy/junit/YIntervalSeriesTests.java

Next
Last

Clone Instance
1

Line Count
121

Source Line
185

Source File

    E:/TSE/Projects-CloneDR/jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XIntervalSeriesTests.java

    /**
     * Simple test for the indexOf() method.
     */
    public void testIndexOf() {
      XIntervalSeries s1 = new XIntervalSeries("Series 1");
      s1.add(1.0, 1.0, 1.0, 2.0);
      s1.add(2.0, 2.0, 2.0, 3.0);
      s1.add(3.0, 3.0, 3.0, 4.0);
      assertEquals(0, s1.indexOf(new Double(1.0)));
    }

    /**
     * A check for the indexOf() method for an unsorted series.
     */
    public void testIndexOf2() {
      XIntervalSeries s1 = new XIntervalSeries("Series 1", false, true);
      s1.add(1.0, 1.0, 1.0, 2.0);
      s1.add(3.0, 3.0, 3.0, 3.0);
      s1.add(2.0, 2.0, 2.0, 2.0);
      assertEquals(0, s1.indexOf(new Double(1.0)));
      assertEquals(1, s1.indexOf(new Double(3.0)));
      assertEquals(2, s1.indexOf(new Double(2.0)));
    }

    /**
     * Simple test for the remove() method.
     */
    public void testRemove() {
      XIntervalSeries s1 = new XIntervalSeries("Series 1");
      s1.add(1.0, 1.0, 1.0, 2.0);
      s1.add(2.0, 2.0, 2.0, 2.0);
      s1.add(3.0, 3.0, 3.0, 3.0);
      assertEquals(3, s1.getItemCount());
      s1.remove(new Double(2.0));
      assertEquals(new Double(3.0), s1.getX(1));
      s1.remove(new Double(1.0));
      assertEquals(new Double(3.0), s1.getX(0));
    }

    private static final double EPSILON = 0.0000000001;

    /**
     * When items are added with duplicate x-values, we expect them to remain
     * in the order they were added.
     */
    public void testAdditionOfDuplicateXValues() {
      XIntervalSeries s1 = new XIntervalSeries("Series 1");
      s1.add(1.0, 1.0, 1.0, 1.0);
      s1.add(2.0, 2.0, 2.0, 2.0);
      s1.add(2.0, 3.0, 3.0, 3.0);
      s1.add(2.0, 4.0, 4.0, 4.0);
      s1.add(3.0, 5.0, 5.0, 5.0);
      assertEquals(1.0, s1.getYValue(0), EPSILON);
      assertEquals(2.0, s1.getYValue(1), EPSILON);
      assertEquals(3.0, s1.getYValue(2), EPSILON);
      assertEquals(4.0, s1.getYValue(3), EPSILON);
      assertEquals(5.0, s1.getYValue(4), EPSILON);
    }

    /**
     * Some checks for the add() method for an UNSORTED series.
     */
    public void testAdd() {
      XIntervalSeries series = new XIntervalSeries("Series", false, true);
      series.add(5.0, 5.50, 5.50, 5.50);
      series.add(5.1, 5.51, 5.51, 5.51);
      series.add(6.0, 6.6, 6.6, 6.6);
      series.add(3.0, 3.3, 3.3, 3.3);
      series.add(4.0, 4.4, 4.4, 4.4);
      series.add(2.0, 2.2, 2.2, 2.2);
      series.add(1.0, 1.1, 1.1, 1.1);
      assertEquals(5.5, series.getYValue(0), EPSILON);
      assertEquals(5.51, series.getYValue(1), EPSILON);
      assertEquals(6.6, series.getYValue(2), EPSILON);
      assertEquals(3.3, series.getYValue(3), EPSILON);
      assertEquals(4.4, series.getYValue(4), EPSILON);
      assertEquals(2.2, series.getYValue(5), EPSILON);
      assertEquals(1.1, series.getYValue(6), EPSILON);
    }

    /**
     * A simple check that the maximumItemCount attribute is working.
     */
    public void testSetMaximumItemCount() {
      XIntervalSeries s1 = new XIntervalSeries("S1");
      assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
      s1.setMaximumItemCount(2);
      assertEquals(2, s1.getMaximumItemCount());
      s1.add(1.0, 1.1, 1.1, 1.1);
      s1.add(2.0, 2.2, 2.2, 2.2);
      s1.add(3.0, 3.3, 3.3, 3.3);
      assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
      assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
    }

    /**
     * Check that the maximum item count can be applied retrospectively.
     */
    public void testSetMaximumItemCount2() {
      XIntervalSeries s1 = new XIntervalSeries("S1");
      s1.add(1.0, 1.1, 1.1, 1.1);
      s1.add(2.0, 2.2, 2.2, 2.2);
      s1.add(3.0, 3.3, 3.3, 3.3);
      s1.setMaximumItemCount(2);
      assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
      assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
    }

    /**
     * Some checks for the clear() method.
     */
    public void testClear() {
      XIntervalSeries s1 = new XIntervalSeries("S1");
      s1.addChangeListener(this );
      s1.clear();
      assertNull(this.lastEvent);
      assertTrue(s1.isEmpty());
      s1.add(1.0, 2.0, 3.0, 4.0);
      assertFalse(s1.isEmpty());
      s1.clear();
      assertNotNull(this.lastEvent);
      assertTrue(s1.isEmpty());
    }

First
Previous

Clone Instance
2

Line Count
121

Source Line
184

Source File

    E:/TSE/Projects-CloneDR/jfreechart-1.0.10/tests/org/jfree/data/xy/junit/YIntervalSeriesTests.java

    /**
     * Simple test for the indexOf() method.
     */
    public void testIndexOf() {
      YIntervalSeries s1 = new YIntervalSeries("Series 1");
      s1.add(1.0, 1.0, 1.0, 2.0);
      s1.add(2.0, 2.0, 2.0, 3.0);
      s1.add(3.0, 3.0, 3.0, 4.0);
      assertEquals(0, s1.indexOf(new Double(1.0)));
    }

    /**
     * A check for the indexOf() method for an unsorted series.
     */
    public void testIndexOf2() {
      YIntervalSeries s1 = new YIntervalSeries("Series 1", false, true);
      s1.add(1.0, 1.0, 1.0, 2.0);
      s1.add(3.0, 3.0, 3.0, 3.0);
      s1.add(2.0, 2.0, 2.0, 2.0);
      assertEquals(0, s1.indexOf(new Double(1.0)));
      assertEquals(1, s1.indexOf(new Double(3.0)));
      assertEquals(2, s1.indexOf(new Double(2.0)));
    }

    /**
     * Simple test for the remove() method.
     */
    public void testRemove() {
      YIntervalSeries s1 = new YIntervalSeries("Series 1");
      s1.add(1.0, 1.0, 1.0, 2.0);
      s1.add(2.0, 2.0, 2.0, 2.0);
      s1.add(3.0, 3.0, 3.0, 3.0);
      assertEquals(3, s1.getItemCount());
      s1.remove(new Double(2.0));
      assertEquals(new Double(3.0), s1.getX(1));
      s1.remove(new Double(1.0));
      assertEquals(new Double(3.0), s1.getX(0));
    }

    private static final double EPSILON = 0.0000000001;

    /**
     * When items are added with duplicate x-values, we expect them to remain
     * in the order they were added.
     */
    public void testAdditionOfDuplicateXValues() {
      YIntervalSeries s1 = new YIntervalSeries("Series 1");
      s1.add(1.0, 1.0, 1.0, 1.0);
      s1.add(2.0, 2.0, 2.0, 2.0);
      s1.add(2.0, 3.0, 3.0, 3.0);
      s1.add(2.0, 4.0, 4.0, 4.0);
      s1.add(3.0, 5.0, 5.0, 5.0);
      assertEquals(1.0, s1.getYValue(0), EPSILON);
      assertEquals(2.0, s1.getYValue(1), EPSILON);
      assertEquals(3.0, s1.getYValue(2), EPSILON);
      assertEquals(4.0, s1.getYValue(3), EPSILON);
      assertEquals(5.0, s1.getYValue(4), EPSILON);
    }

    /**
     * Some checks for the add() method for an UNSORTED series.
     */
    public void testAdd() {
      YIntervalSeries series = new YIntervalSeries("Series", false, true);
      series.add(5.0, 5.50, 5.50, 5.50);
      series.add(5.1, 5.51, 5.51, 5.51);
      series.add(6.0, 6.6, 6.6, 6.6);
      series.add(3.0, 3.3, 3.3, 3.3);
      series.add(4.0, 4.4, 4.4, 4.4);
      series.add(2.0, 2.2, 2.2, 2.2);
      series.add(1.0, 1.1, 1.1, 1.1);
      assertEquals(5.5, series.getYValue(0), EPSILON);
      assertEquals(5.51, series.getYValue(1), EPSILON);
      assertEquals(6.6, series.getYValue(2), EPSILON);
      assertEquals(3.3, series.getYValue(3), EPSILON);
      assertEquals(4.4, series.getYValue(4), EPSILON);
      assertEquals(2.2, series.getYValue(5), EPSILON);
      assertEquals(1.1, series.getYValue(6), EPSILON);
    }

    /**
     * A simple check that the maximumItemCount attribute is working.
     */
    public void testSetMaximumItemCount() {
      YIntervalSeries s1 = new YIntervalSeries("S1");
      assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
      s1.setMaximumItemCount(2);
      assertEquals(2, s1.getMaximumItemCount());
      s1.add(1.0, 1.1, 1.1, 1.1);
      s1.add(2.0, 2.2, 2.2, 2.2);
      s1.add(3.0, 3.3, 3.3, 3.3);
      assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
      assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
    }

    /**
     * Check that the maximum item count can be applied retrospectively.
     */
    public void testSetMaximumItemCount2() {
      YIntervalSeries s1 = new YIntervalSeries("S1");
      s1.add(1.0, 1.1, 1.1, 1.1);
      s1.add(2.0, 2.2, 2.2, 2.2);
      s1.add(3.0, 3.3, 3.3, 3.3);
      s1.setMaximumItemCount(2);
      assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
      assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
    }

    /**
     * Some checks for the clear() method.
     */
    public void testClear() {
      YIntervalSeries s1 = new YIntervalSeries("S1");
      s1.addChangeListener(this );
      s1.clear();
      assertNull(this.lastEvent);
      assertTrue(s1.isEmpty());
      s1.add(1.0, 2.0, 3.0, 4.0);
      assertFalse(s1.isEmpty());
      s1.clear();
      assertNotNull(this.lastEvent);
      assertTrue(s1.isEmpty());
    }

Clone Abstraction | Parameter Count: 1 | Parameter Bindings

    /**
         * Simple test for the indexOf() method.
         */
    public void testIndexOf() {
       [[#variable15347100]] s1 = new [[#variable15347100]]("Series 1");
      s1.add(1.0, 1.0, 1.0, 2.0);
      s1.add(2.0, 2.0, 2.0, 3.0);
      s1.add(3.0, 3.0, 3.0, 4.0);
      assertEquals(0, s1.indexOf(new Double(1.0)));
    }

    /**
         * A check for the indexOf() method for an unsorted series.
         */
    public void testIndexOf2() {
       [[#variable15347100]] s1 = new [[#variable15347100]]("Series 1", false, true);
      s1.add(1.0, 1.0, 1.0, 2.0);
      s1.add(3.0, 3.0, 3.0, 3.0);
      s1.add(2.0, 2.0, 2.0, 2.0);
      assertEquals(0, s1.indexOf(new Double(1.0)));
      assertEquals(1, s1.indexOf(new Double(3.0)));
      assertEquals(2, s1.indexOf(new Double(2.0)));
    }

    /**
         * Simple test for the remove() method.
         */
    public void testRemove() {
       [[#variable15347100]] s1 = new [[#variable15347100]]("Series 1");
      s1.add(1.0, 1.0, 1.0, 2.0);
      s1.add(2.0, 2.0, 2.0, 2.0);
      s1.add(3.0, 3.0, 3.0, 3.0);
      assertEquals(3, s1.getItemCount());
      s1.remove(new Double(2.0));
      assertEquals(new Double(3.0), s1.getX(1));
      s1.remove(new Double(1.0));
      assertEquals(new Double(3.0), s1.getX(0));
    }

    private static final double EPSILON = 0.0000000001;

    /**
         * When items are added with duplicate x-values, we expect them to remain
         * in the order they were added.
         */
    /**
         * When items are added with duplicate x-values, we expect them to remain
         * in the order they were added.
         */
    public void testAdditionOfDuplicateXValues() {
       [[#variable15347100]] s1 = new [[#variable15347100]]("Series 1");
      s1.add(1.0, 1.0, 1.0, 1.0);
      s1.add(2.0, 2.0, 2.0, 2.0);
      s1.add(2.0, 3.0, 3.0, 3.0);
      s1.add(2.0, 4.0, 4.0, 4.0);
      s1.add(3.0, 5.0, 5.0, 5.0);
      assertEquals(1.0, s1.getYValue(0), EPSILON);
      assertEquals(2.0, s1.getYValue(1), EPSILON);
      assertEquals(3.0, s1.getYValue(2), EPSILON);
      assertEquals(4.0, s1.getYValue(3), EPSILON);
      assertEquals(5.0, s1.getYValue(4), EPSILON);
    }

    /**
         * Some checks for the add() method for an UNSORTED series.
         */
    public void testAdd() {
       [[#variable15347100]] series = new [[#variable15347100]]("Series", false, true);
      series.add(5.0, 5.50, 5.50, 5.50);
      series.add(5.1, 5.51, 5.51, 5.51);
      series.add(6.0, 6.6, 6.6, 6.6);
      series.add(3.0, 3.3, 3.3, 3.3);
      series.add(4.0, 4.4, 4.4, 4.4);
      series.add(2.0, 2.2, 2.2, 2.2);
      series.add(1.0, 1.1, 1.1, 1.1);
      assertEquals(5.5, series.getYValue(0), EPSILON);
      assertEquals(5.51, series.getYValue(1), EPSILON);
      assertEquals(6.6, series.getYValue(2), EPSILON);
      assertEquals(3.3, series.getYValue(3), EPSILON);
      assertEquals(4.4, series.getYValue(4), EPSILON);
      assertEquals(2.2, series.getYValue(5), EPSILON);
      assertEquals(1.1, series.getYValue(6), EPSILON);
    }

    /**
         * A simple check that the maximumItemCount attribute is working.
         */
    public void testSetMaximumItemCount() {
       [[#variable15347100]] s1 = new [[#variable15347100]]("S1");
      assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
      s1.setMaximumItemCount(2);
      assertEquals(2, s1.getMaximumItemCount());
      s1.add(1.0, 1.1, 1.1, 1.1);
      s1.add(2.0, 2.2, 2.2, 2.2);
      s1.add(3.0, 3.3, 3.3, 3.3);
      assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
      assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
    }

    /**
         * Check that the maximum item count can be applied retrospectively.
         */
    public void testSetMaximumItemCount2() {
       [[#variable15347100]] s1 = new [[#variable15347100]]("S1");
      s1.add(1.0, 1.1, 1.1, 1.1);
      s1.add(2.0, 2.2, 2.2, 2.2);
      s1.add(3.0, 3.3, 3.3, 3.3);
      s1.setMaximumItemCount(2);
      assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
      assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
    }

    /**
         * Some checks for the clear() method.
         */
    public void testClear() {
       [[#variable15347100]] s1 = new [[#variable15347100]]("S1");
      s1.addChangeListener(this );
      s1.clear();
      assertNull(this.lastEvent);
      assertTrue(s1.isEmpty());
      s1.add(1.0, 2.0, 3.0, 4.0);
      assertFalse(s1.isEmpty());
      s1.clear();
      assertNotNull(this.lastEvent);
      assertTrue(s1.isEmpty());
    }

CloneAbstraction

Parameter Bindings
Parameter Index | Clone Instance | Parameter Name | Value
--- | --- | --- | ---

1

1

`[[#15347100]]`

    XIntervalSeries

1

2

`[[#15347100]]`

    YIntervalSeries