summaryrefslogtreecommitdiffstats
path: root/rba.tool.core/src/rba/tool/core/sort/SortValue.java
blob: 61ceaa9b0bf0858a7298dcee6202836ad36d6ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package rba.tool.core.sort;

import java.util.HashMap;
import java.util.Map;

import rba.tool.core.z3.Z3Constants;

public class SortValue {
    private Map<String, Integer> sortMap = new HashMap<String, Integer>();

    private boolean unsat = false;

    public void setSortValue(Map<String, Integer> map) {
        if (map == null) {
            clear();
            return;
        }

        sortMap = map;
        Integer result = map.get(Z3Constants.TOTAL_RESULT);
        if (result == Z3Constants.UNSAT_VAL) {
            unsat = true;
        }
    }

    public boolean isUnsat() {
        return unsat;
    }

    public Integer getValue(String name) {
        if (!sortMap.isEmpty()) {
            Integer integer = sortMap.get(name);
            if (integer != null) {
                return integer;
            }
        }

        return Z3Constants.UNKNOWN_VAL;
    }

    public void clear() {
        sortMap.clear();
        unsat = false;
    }
}