101-1-2

public void testFindLiveItemsLowerBoundUnordered() { DefaultXYDataset d = new DefaultXYDataset(); // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.0)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 2.0, 3.3)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {2.0, 2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.0, 2.2)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 1.5}, {2.0, 2.0, 2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.2)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 1.5, 1.8}, {2.0, 2.0, 2.0, 2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, 2.2)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, 3.3)); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.0, 5.5));
public void testFindLiveItemsLowerBoundAscending() { DefaultXYDataset d = new DefaultXYDataset() { public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {2.0, 2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.0, 2.2)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {2.0, 2.0, 2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.2)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {2.0, 2.0, 2.0, 2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, 2.2)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, 4.4)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.0, 5.5));

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/junit/RendererUtilitiesTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/junit/RendererUtilitiesTests.java
Method name: `` |  | Method name: ``
Number of AST nodes: 0 |  | Number of AST nodes: 0

1

    public void testFindLiveItemsLowerBoundUnordered() {↵

1

    public void testFindLiveItemsLowerBoundAscending() {↵

2

            DefaultXYDataset d = new DefaultXYDataset();↵

2

            DefaultXYDataset d = new DefaultXYDataset()↵

3

            ↵

3

     {↵

4

                public DomainOrder getDomainOrder() {↵

5

                    // we're doing this for testing only, and make sure that we ↵

6

                    // only add data in ascending order by x-value↵

7

                    return DomainOrder.ASCENDING;↵

8

                }↵

9

            };↵

4

            // check a series with no items↵

10

            // check a series with no items↵

5

            d.addSeries("S1", new double[][] {{}, {}});↵

11

            d.addSeries("S1", new double[][] {{}, {}});↵

6

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, ↵

12

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, ↵

7

                    11.0));↵

13

                    11.1));↵

8

            ↵

14

            ↵

9

            // check a series with one item↵

15

            // check a series with one item↵

10

            d.addSeries("S2", new double[][] {{1.0}, {2.0}});↵

16

            d.addSeries("S2", new double[][] {{1.0}, {2.0}});↵

11

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, ↵

17

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, ↵

12

                    1.1));↵

18

                    1.1));↵

13

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 2.0, ↵

19

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 2.0, ↵

14

                    3.3));↵

20

                    2.2));↵

15

            ↵

21

            ↵

16

            // check a series with two items↵

22

            // check a series with two items↵

17

            d.addSeries("S3", new double[][] {{1.0, 2.0}, {2.0, 2.0}});↵

23

            d.addSeries("S3", new double[][] {{1.0, 2.0}, {2.0, 2.0}});↵

18

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.0, ↵

24

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.0, ↵

19

                    1.1));↵

25

                    1.1));↵

20

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.0, ↵

26

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.0, ↵

21

                    2.2));↵

27

                    2.2));↵

22

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.0, ↵

28

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.0, ↵

23

                    3.3));↵

29

                    3.3));↵

24

            assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.0, ↵

30

            assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.0, ↵

25

                    4.4));↵

31

                    4.4));↵

26

            ↵

32

            ↵

27

            // check a series with three items↵

33

            // check a series with three items↵

28

            d.addSeries("S4", new double[][] {{1.0, 2.0, 1.5}, {2.0, 2.0, 2.0}});↵

34

            d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {2.0, 2.0, 2.0}});↵

29

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, ↵

35

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, ↵

30

                    1.1));↵

36

                    1.1));↵

31

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, ↵

37

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, ↵

32

                    2.2));↵

38

                    2.2));↵

33

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, ↵

39

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, ↵

34

                    3.3));↵

40

                    3.3));↵

35

            assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, ↵

41

            assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, ↵

36

                    4.4));↵

42

                    4.4));↵

37

            ↵

43

            ↵

38

            // check a series with four items↵

44

            // check a series with four items↵

39

            d.addSeries("S5", new double[][] {{1.0, 2.0, 1.5, 1.8}, {2.0, 2.0, ↵

45

            d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {2.0, 2.0, ↵

40

                    2.0, 2.0}});↵

46

                    2.0, 2.0}});↵

41

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, ↵

47

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, ↵

42

                    1.1));↵

48

                    1.1));↵

43

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, ↵

49

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, ↵

44

                    2.2));↵

50

                    2.2));↵

45

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, ↵

51

            assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, ↵

46

                    3.3));↵

52

                    3.3));↵

47

            assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, ↵

53

            assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, ↵

48

                    4.4));↵

54

                    4.4));↵

49

            assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.0, ↵

55

            assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.0, ↵

50

                    5.5));↵

56

                    5.5));↵

51

57

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location |
Number of node comparisons | 0