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

torand / FasterSQL / 16990059345

15 Aug 2025 12:34PM UTC coverage: 66.782% (-6.6%) from 73.399%
16990059345

push

github

torand
chore: access central snapshots

294 of 598 branches covered (49.16%)

Branch coverage included in aggregate %.

1638 of 2295 relevant lines covered (71.37%)

3.83 hits per line

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

76.92
/src/main/java/io/github/torand/fastersql/predicate/comparison/Between.java
1
/*
2
 * Copyright (c) 2024-2025 Tore Eide Andersen
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package io.github.torand.fastersql.predicate.comparison;
17

18
import io.github.torand.fastersql.alias.ColumnAlias;
19
import io.github.torand.fastersql.expression.Expression;
20
import io.github.torand.fastersql.model.Column;
21
import io.github.torand.fastersql.predicate.LeftOperand;
22
import io.github.torand.fastersql.predicate.Predicate;
23
import io.github.torand.fastersql.sql.Context;
24

25
import java.util.stream.Stream;
26

27
import static io.github.torand.fastersql.sql.Clause.RESTRICTION;
28
import static io.github.torand.javacommons.stream.StreamHelper.concatStreams;
29
import static java.util.Objects.requireNonNull;
30

31
/**
32
 * Implements the between predicate.
33
 */
34
public class Between implements Predicate {
35
    private final LeftOperand left;
36
    private final Expression lowerBound;
37
    private final Expression upperBound;
38

39
    Between(LeftOperand left, Expression lowerBound, Expression upperBound) {
2✔
40
        this.left = requireNonNull(left, "No left operand specified");
6✔
41
        this.lowerBound = requireNonNull(lowerBound, "No lower bound expression specified");
6✔
42
        this.upperBound = requireNonNull(upperBound, "No upper bound expression specified");
6✔
43
    }
1✔
44

45
    // Sql
46

47
    @Override
48
    public String sql(Context context) {
49
        Context localContext = context.withClause(RESTRICTION);
4✔
50
        return left.sql(localContext) + " between " + lowerBound.sql(localContext) + " and " + upperBound.sql(localContext);
14✔
51
    }
52

53
    @Override
54
    public Stream<Object> params(Context context) {
55
        Context localContext = context.withClause(RESTRICTION);
4✔
56
        return concatStreams(left.params(localContext), lowerBound.params(localContext), upperBound.params(localContext));
25✔
57
    }
58

59
    @Override
60
    public Stream<Column> columnRefs() {
61
        return concatStreams(left.columnRefs(), lowerBound.columnRefs(), upperBound.columnRefs());
22✔
62
    }
63

64
    @Override
65
    public Stream<ColumnAlias> aliasRefs() {
66
        return concatStreams(left.aliasRefs(), lowerBound.aliasRefs(), upperBound.aliasRefs());
×
67
    }
68

69
    // Predicate
70

71
    public String negatedSql(Context context) {
72
        Context localContext = context.withClause(RESTRICTION);
×
73
        return left.sql(localContext) + " not between " + lowerBound.sql(localContext) + " and " + upperBound.sql(localContext);
×
74
    }
75
}
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