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

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

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

59.26
/src/main/java/org/cyclops/integrateddynamics/core/evaluate/variable/ValueOptionalBase.java
1
package org.cyclops.integrateddynamics.core.evaluate.variable;
2

3
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueType;
4

5
import javax.annotation.Nullable;
6
import java.util.Optional;
7

8
/**
9
 * Base value implementation for nullable values.
10
 * @author rubensworks
11
 */
12
public abstract class ValueOptionalBase<T> extends ValueBase {
13

14
    private final Optional<T> value;
15

16
    public ValueOptionalBase(IValueType type, @Nullable T value) {
17
        super(type);
3✔
18
        this.value = Optional.ofNullable(preprocessValue(value));
6✔
19
    }
1✔
20

21
    @Nullable
22
    protected T preprocessValue(@Nullable T value) {
23
        return value;
×
24
    }
25

26
    /**
27
     * @return The raw value in an optional holder.
28
     */
29
    public Optional<T> getRawValue() {
30
        return value;
3✔
31
    }
32

33
    @SuppressWarnings("unchecked")
34
    @Override
35
    public boolean equals(Object o) {
36
        if((o instanceof ValueOptionalBase) && getType() == ((ValueOptionalBase) o).getType()) {
9!
37
            if (((ValueOptionalBase) o).getRawValue().isPresent() && getRawValue().isPresent()) {
9!
38
                return isEqual(((ValueOptionalBase<T>) o).getRawValue().get(), getRawValue().get());
10✔
39
            } else if (!((ValueOptionalBase) o).getRawValue().isPresent() && !getRawValue().isPresent()) {
9!
40
                return true;
2✔
41
            }
42
        }
43
        return false;
×
44
    }
45

46
    protected abstract boolean isEqual(T a, T b);
47

48
    @Override
49
    public int hashCode() {
50
        return getType().hashCode() + (getRawValue().isPresent() ? getRawValue().get().hashCode() : 0);
×
51
    }
52

53
    @Override
54
    public String toString() {
55
        return getRawValue().toString();
×
56
    }
57
}
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