Search in sources :

Example 1 with Inst

use of catdata.fql.cat.Inst in project fql by CategoricalData.

the class Instance method toFunctor2.

public Inst<Node, Path, Object, Object> toFunctor2() throws FQLException {
    FinCat<Node, Path> cat = thesig.toCategory2().first;
    Map<Node, Set<Value<Object, Object>>> objM = new HashMap<>();
    for (Node obj : cat.objects) {
        if (data.get(obj.string) == null) {
            throw new RuntimeException("No data for " + obj + " in " + data);
        }
        objM.put(obj, conv(data.get(obj.string)));
    }
    Map<Arr<Node, Path>, Map<Value<Object, Object>, Value<Object, Object>>> arrM = new HashMap<>();
    for (Arr<Node, Path> arr : cat.arrows) {
        List<String> es = arr.arr.asList();
        String h = es.get(0);
        Set<Pair<Object, Object>> h0 = data.get(h);
        for (int i = 1; i < es.size(); i++) {
            h0 = compose2(h0, data.get(es.get(i)));
        }
        Map<Value<Object, Object>, Value<Object, Object>> xxx = FDM.degraph(h0);
        arrM.put(arr, xxx);
    }
    return new Inst<>(objM, arrM, cat);
}
Also used : Arr(catdata.fql.cat.Arr) Set(java.util.Set) HashSet(java.util.HashSet) Inst(catdata.fql.cat.Inst) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Paint(java.awt.Paint) Value(catdata.fql.cat.Value) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Pair(catdata.Pair)

Aggregations

Pair (catdata.Pair)1 Arr (catdata.fql.cat.Arr)1 Inst (catdata.fql.cat.Inst)1 Value (catdata.fql.cat.Value)1 Paint (java.awt.Paint)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Set (java.util.Set)1