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

leeonky / test-charm-java / 341

06 Oct 2025 09:31AM UTC coverage: 74.7% (+0.03%) from 74.667%
341

push

circleci

leeonky
More test for list consistency index mapping

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

8642 of 11569 relevant lines covered (74.7%)

0.75 hits per line

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

95.24
/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.Collections.singletonList;
11

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

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

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

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

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

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

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

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

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

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

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

60
    public static D1 d1(Index index) {
61
        return new D1(singletonList(index));
1✔
62
    }
63

64
    private static List<Index> require(List<Index> indexes, int size) {
65
        if (indexes.size() != size)
1✔
NEW
66
            throw new IllegalArgumentException("Coordinate size not match");
×
67
        return indexes;
1✔
68
    }
69
}
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