• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

leeonky / test-charm-java / 347

07 Oct 2025 09:20AM UTC coverage: 74.946% (+0.2%) from 74.7%
347

push

circleci

leeonky
raise error when dependent value changed

23 of 23 new or added lines in 3 files covered. (100.0%)

20 existing lines in 6 files now uncovered.

8723 of 11639 relevant lines covered (74.95%)

0.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.62
/jfactory/src/main/java/com/github/leeonky/jfactory/Coordinate.java
1
package com.github.leeonky.jfactory;
2

3
import com.github.leeonky.util.BeanClass;
4

5
import java.util.ArrayList;
6
import java.util.Collections;
7
import java.util.List;
8
import java.util.stream.Collectors;
9

10
import static java.util.Arrays.asList;
11
import static java.util.Collections.singletonList;
12

13
public class Coordinate {
14
    private final List<Index> indexes = new ArrayList<>();
1✔
15

16
    public Coordinate(List<Index> indexes) {
1✔
17
        this.indexes.addAll(indexes);
1✔
18
    }
1✔
19

20
    public List<Index> indexes() {
21
        return indexes;
1✔
22
    }
23

24
    public <C extends Coordinate> C convertTo(BeanClass<C> type) {
25
        return type.newInstance(indexes());
1✔
26
    }
27

28
    public Coordinate reverse() {
29
        return new Coordinate(indexes.stream().map(Index::reverse).collect(Collectors.toList()));
1✔
30
    }
31

32
    public Coordinate shift(int adjust) {
33
        return new Coordinate(indexes().stream().map(i -> i.shift(adjust)).collect(Collectors.toList()));
1✔
34
    }
35

36
    public Coordinate sample(int period, int offset) {
37
        List<Index> indexes = indexes().stream().map(i -> i.sample(period, offset)).collect(Collectors.toList());
1✔
38
        return indexes.contains(null) ? null : new Coordinate(indexes);
1✔
39
    }
40

41
    public Coordinate interpolate(int period, int offset) {
42
        return new Coordinate(indexes().stream().map(i -> i.interpolate(period, offset)).collect(Collectors.toList()));
1✔
43
    }
44

45
    public Coordinate transpose() {
46
        List<Index> indexes = new ArrayList<>(indexes());
1✔
47
        Collections.reverse(indexes);
1✔
48
        return new Coordinate(indexes);
1✔
49
    }
50

51
    public static class D1 extends Coordinate {
52
        public D1(List<Index> index) {
53
            super(require(index, 1));
1✔
54
        }
1✔
55

56
        public Index index() {
57
            return indexes().get(0);
1✔
58
        }
59
    }
60

61
    public static class D2 extends Coordinate {
62
        public D2(List<Index> index) {
63
            super(require(index, 2));
1✔
64
        }
1✔
65

66
        public Index index0() {
UNCOV
67
            return indexes().get(0);
×
68
        }
69

70
        public Index index1() {
UNCOV
71
            return indexes().get(1);
×
72
        }
73
    }
74

75
    public static D1 d1(Index index) {
76
        return new D1(singletonList(index));
1✔
77
    }
78

79
    public static D2 d2(Index index0, Index index1) {
UNCOV
80
        return new D2(asList(index0, index1));
×
81
    }
82

83
    private static List<Index> require(List<Index> indexes, int size) {
84
        if (indexes.size() != size)
1✔
UNCOV
85
            throw new IllegalArgumentException("Coordinate size not match");
×
86
        return indexes;
1✔
87
    }
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc