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

leeonky / test-charm-java / 290

08 Sep 2025 03:25PM UTC coverage: 74.312% (-0.003%) from 74.315%
290

push

circleci

leeonky
Introduce PropertyWriterDecorator

10 of 25 new or added lines in 6 files covered. (40.0%)

20 existing lines in 10 files now uncovered.

8155 of 10974 relevant lines covered (74.31%)

0.74 hits per line

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

88.24
/DAL-java/src/main/java/com/github/leeonky/dal/ast/node/table/RowType.java
1
package com.github.leeonky.dal.ast.node.table;
2

3
import com.github.leeonky.dal.ast.node.*;
4
import com.github.leeonky.dal.ast.node.InputNode.StackInput;
5
import com.github.leeonky.dal.ast.opt.Factory;
6
import com.github.leeonky.dal.runtime.Data;
7
import com.github.leeonky.dal.runtime.RuntimeContextBuilder.DALRuntimeContext;
8
import com.github.leeonky.interpreter.Clause;
9

10
import java.util.Collections;
11
import java.util.Comparator;
12
import java.util.List;
13
import java.util.Optional;
14
import java.util.stream.Stream;
15

16
import static com.github.leeonky.dal.ast.node.DALExpression.expression;
17
import static com.github.leeonky.dal.ast.node.SymbolNode.Type.BRACKET;
18
import static com.github.leeonky.dal.ast.node.table.SpecifyIndexRowType.indexToExpression;
19
import static com.github.leeonky.dal.compiler.Notations.EMPTY;
20
import static com.github.leeonky.util.function.When.when;
21
import static java.util.stream.Collectors.toList;
22

23
public abstract class RowType {
1✔
24

25
    public abstract RowType merge(RowType another);
26

27
    protected RowType mergeBy(SpecifyIndexRowType specifyIndexRowType) {
28
        throw new IllegalArgumentException();
1✔
29
    }
30

31
    protected RowType mergeBy(DefaultIndexRowType defaultIndexRowType) {
UNCOV
32
        throw new IllegalArgumentException();
×
33
    }
34

35
    protected RowType mergeBy(SpecifyPropertyRowType specifyPropertyRowType) {
36
        throw new IllegalArgumentException();
1✔
37
    }
38

39
    public abstract DALNode constructVerificationNode(Data<?> actual, Stream<Clause<DALNode>> rowClauses,
40
                                                      Comparator<Data<?>> comparator);
41

42
    public DALNode constructAccessingRowNode(DALNode input, Optional<DALNode> indexOrKey, DALRuntimeContext context) {
43
        return input;
1✔
44
    }
45
}
46

47
class EmptyTableRowType extends RowType {
1✔
48

49
    @Override
50
    public RowType merge(RowType another) {
51
        return another;
1✔
52
    }
53

54
    @Override
55
    protected RowType mergeBy(SpecifyIndexRowType specifyIndexRowType) {
UNCOV
56
        return this;
×
57
    }
58

59
    @Override
60
    protected RowType mergeBy(DefaultIndexRowType defaultIndexRowType) {
UNCOV
61
        return this;
×
62
    }
63

64
    @Override
65
    protected RowType mergeBy(SpecifyPropertyRowType specifyPropertyRowType) {
UNCOV
66
        return this;
×
67
    }
68

69
    @Override
70
    public DALNode constructVerificationNode(Data<?> actual, Stream<Clause<DALNode>> rowClauses,
71
                                             Comparator<Data<?>> comparator) {
72
        return actual.isList() ? new ListScopeNode(rowClauses.collect(toList()), comparator, ListScopeNode.Style.TABLE)
1✔
73
                : new ObjectScopeNode(Collections.emptyList());
1✔
74
    }
75
}
76

77
class SpecifyIndexRowType extends RowType {
1✔
78
    @Override
79
    public RowType merge(RowType another) {
80
        return another.mergeBy(this);
1✔
81
    }
82

83
    @Override
84
    protected RowType mergeBy(SpecifyIndexRowType specifyIndexRowType) {
85
        return specifyIndexRowType;
1✔
86
    }
87

88
    @Override
89
    protected RowType mergeBy(SpecifyPropertyRowType specifyPropertyRowType) {
90
        return specifyPropertyRowType;
1✔
91
    }
92

93
    @Override
94
    public DALNode constructVerificationNode(Data<?> actual, Stream<Clause<DALNode>> rowClauses,
95
                                             Comparator<Data<?>> comparator) {
96
        List<DALNode> rowNodes = rowClauses.map(rowClause -> rowClause.expression(null))
1✔
97
                .collect(toList());
1✔
98
        if (actual.isList())
1✔
99
            return new ListScopeNode(rowNodes, ListScopeNode.Type.FIRST_N_ITEMS, comparator, ListScopeNode.Style.TABLE);
1✔
100
        return new ObjectScopeNode(rowNodes);
1✔
101
    }
102

103
    @Override
104
    public DALNode constructAccessingRowNode(DALNode input, Optional<DALNode> indexOrKey, DALRuntimeContext context) {
105
        return indexOrKey.flatMap(node -> indexToExpression(node, context)).orElseThrow(IllegalStateException::new);
1✔
106
    }
107

108
    static Optional<DALNode> indexToExpression(DALNode node, DALRuntimeContext context) {
109
        return when(node instanceof ConstValueNode).optional(() -> expression(new StackInput(context), Factory.executable(EMPTY),
1✔
110
                new SymbolNode(((ConstValueNode) node).getValue(), BRACKET).setPositionBegin(node.getPositionBegin())));
1✔
111
    }
112
}
113

114
class DefaultIndexRowType extends RowType {
1✔
115
    @Override
116
    public RowType merge(RowType another) {
117
        return another.mergeBy(this);
1✔
118
    }
119

120
    @Override
121
    protected RowType mergeBy(DefaultIndexRowType defaultIndexRowType) {
122
        return defaultIndexRowType;
1✔
123
    }
124

125
    @Override
126
    public DALNode constructVerificationNode(Data<?> actual, Stream<Clause<DALNode>> rowClauses,
127
                                             Comparator<Data<?>> comparator) {
128
        return new ListScopeNode(rowClauses.collect(toList()), comparator, ListScopeNode.Style.TABLE);
1✔
129
    }
130
}
131

132
class SpecifyPropertyRowType extends RowType {
1✔
133

134
    @Override
135
    public RowType merge(RowType another) {
136
        return another.mergeBy(this);
1✔
137
    }
138

139
    @Override
140
    public DALNode constructVerificationNode(Data<?> actual, Stream<Clause<DALNode>> rowClauses,
141
                                             Comparator<Data<?>> comparator) {
142
        return new ObjectScopeNode(rowClauses.map(rowNode -> rowNode.expression(null)).collect(toList()));
1✔
143
    }
144

145
    @Override
146
    protected RowType mergeBy(SpecifyPropertyRowType specifyPropertyRowType) {
147
        return specifyPropertyRowType;
1✔
148
    }
149

150
    @Override
151
    protected RowType mergeBy(SpecifyIndexRowType specifyIndexRowType) {
152
        return this;
1✔
153
    }
154

155
    @Override
156
    public DALNode constructAccessingRowNode(DALNode input, Optional<DALNode> indexOrKey, DALRuntimeContext context) {
157
        return indexOrKey.map(node -> indexToExpression(node, context).orElse(node)).orElseThrow(IllegalStateException::new);
1✔
158
    }
159
}
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