m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueUtils.java
blob: 866349f9d8fed6beccad2a3e2eed8f074890b037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package pl.edu.mimuw.cloudatlas.model;

public class ValueUtils {
    public static boolean valueNonNullOfType(Value value, Type type) {
        return value != null && !value.isNull() && value.getType().isCompatible(type);
    }

    public static boolean valueLower(Value a, Value b) {
        return ((ValueBoolean) a.isLowerThan(b)).getValue();
    }

    public static ValueTime currentTime() {
        return new ValueTime(System.currentTimeMillis());
    }

    public static ValueTime addToTime(ValueTime time, long millis) {
        return time.addValue(new ValueDuration(millis));
    }
}