SecantsCalculator.kt

1
package com.github.sanity.pav.spline
2
3
import com.github.sanity.pav.Point
4
import com.github.sanity.pav.toArrayList
5
import java.util.*
6
7
/**
8
 * Created by ian on 12/9/16.
9
 */
10
class SecantsCalculator {
11
    companion object {
12
        fun calculate(points: List<Point>): ArrayList<PointWithSecants> {
13
            val fastPoints: List<Point> = points.toArrayList()
14
15
            val numberOfPoints = fastPoints.size
16 1 1. calculate : Replaced integer subtraction with addition → SURVIVED
            val secants = ArrayList<Secant>(numberOfPoints - 1)
17 5 1. calculate : changed conditional boundary → KILLED
2. calculate : Changed increment from 1 to -1 → KILLED
3. calculate : Replaced integer subtraction with addition → KILLED
4. calculate : negated conditional → KILLED
5. calculate : negated conditional → KILLED
            for (x in 0..(numberOfPoints - 2)) {
18 1 1. calculate : Replaced integer addition with subtraction → KILLED
                secants.add(Secant(fastPoints[x], fastPoints[x + 1]))
19
            }
20
21
            val pointsWithSecants = ArrayList<PointWithSecants>(numberOfPoints)
22 5 1. calculate : changed conditional boundary → SURVIVED
2. calculate : Changed increment from 1 to -1 → KILLED
3. calculate : Replaced integer subtraction with addition → KILLED
4. calculate : negated conditional → KILLED
5. calculate : negated conditional → KILLED
            for (x in fastPoints.indices) {
23 5 1. calculate : changed conditional boundary → KILLED
2. calculate : changed conditional boundary → KILLED
3. calculate : Replaced integer subtraction with addition → KILLED
4. calculate : negated conditional → KILLED
5. calculate : negated conditional → KILLED
                pointsWithSecants
24
                        .add(PointWithSecants(fastPoints[x], (if (x > 0) secants[x - 1] else null), if (x < secants.size) secants[x] else null))
25
            }
26 1 1. calculate : mutated return of Object value for com/github/sanity/pav/spline/SecantsCalculator$Companion::calculate to ( if (x != null) null else throw new RuntimeException ) → KILLED
            return pointsWithSecants
27
        }
28
    }
29
}

Mutations

16

1.1
Location : calculate
Killed by : none
Replaced integer subtraction with addition → SURVIVED

17

1.1
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
changed conditional boundary → KILLED

2.2
Location : calculate
Killed by : com.github.sanity.pav.spline.MonotoneSplineSpec.com.github.sanity.pav.spline.MonotoneSplineSpec
Changed increment from 1 to -1 → KILLED

3.3
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
Replaced integer subtraction with addition → KILLED

4.4
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
negated conditional → KILLED

5.5
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
negated conditional → KILLED

18

1.1
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
Replaced integer addition with subtraction → KILLED

22

1.1
Location : calculate
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
Changed increment from 1 to -1 → KILLED

3.3
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
Replaced integer subtraction with addition → KILLED

4.4
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
negated conditional → KILLED

5.5
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
negated conditional → KILLED

23

1.1
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
changed conditional boundary → KILLED

2.2
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
changed conditional boundary → KILLED

3.3
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
Replaced integer subtraction with addition → KILLED

4.4
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
negated conditional → KILLED

5.5
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
negated conditional → KILLED

26

1.1
Location : calculate
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
mutated return of Object value for com/github/sanity/pav/spline/SecantsCalculator$Companion::calculate to ( if (x != null) null else throw new RuntimeException ) → KILLED

Active mutators

Tests examined


Report generated by PIT 1.1.10