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

torand / FasterSQL / 12970217277

26 Jan 2025 01:31AM UTC coverage: 49.458%. Remained the same
12970217277

push

github

torand
refactor: condition -> predicate

108 of 322 branches covered (33.54%)

Branch coverage included in aggregate %.

58 of 137 new or added lines in 12 files covered. (42.34%)

3 existing lines in 2 files now uncovered.

622 of 1154 relevant lines covered (53.9%)

2.85 hits per line

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

16.67
/src/main/java/io/github/torand/fastersql/predicate/Predicate.java
1
/*
2
 * Copyright (c) 2024 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;
17

18
import io.github.torand.fastersql.Context;
19
import io.github.torand.fastersql.Field;
20
import io.github.torand.fastersql.Sql;
21
import io.github.torand.fastersql.predicate.compound.CompoundPredicates;
22

23
import java.util.stream.Stream;
24

25
/**
26
 * Represents a restriction on the rows fetched by a query or affected by an update or delete.
27
 */
28
public interface Predicate extends Sql {
29
    String negatedSql(Context context);
30

31
    Stream<Field> fieldRefs();
32

33
    default Predicate or(Predicate other) {
34
        return CompoundPredicates.or(this, other);
12✔
35
    }
36

37
    default OptionalPredicate or(OptionalPredicate maybeOther) {
38
        if (maybeOther.isPresent()) {
×
NEW
39
            return OptionalPredicate.of(CompoundPredicates.or(this, maybeOther.get()));
×
40
        } else {
NEW
41
            return OptionalPredicate.of(this);
×
42
        }
43
    }
44

45
    default Predicate and(Predicate other) {
46
        return CompoundPredicates.and(this, other);
12✔
47
    }
48

49
    default OptionalPredicate and(OptionalPredicate maybeOther) {
50
        if (maybeOther.isPresent()) {
×
NEW
51
            return OptionalPredicate.of(CompoundPredicates.and(this, maybeOther.get()));
×
52
        } else {
NEW
53
            return OptionalPredicate.of(this);
×
54
        }
55
    }
56
}
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