Example #1
0
 public void modify(Mutable m) {
   if (!(m instanceof SatOp)) return;
   SatOp satop = (SatOp) m;
   if (!(satop.getArg() instanceof Proposition)) return;
   Proposition prop = (Proposition) satop.getArg();
   if (!prop.getName().equals(DEFAULT_VAL)) return;
   if (!(satop.getNominal() instanceof NominalVar)) return;
   NominalVar nv = (NominalVar) satop.getNominal();
   SimpleType st = nv.getType();
   // check equality
   if (st.equals(SEMCLASS)) return;
   // otherwise unify types, update nv
   try {
     SimpleType stU = (SimpleType) st.unify(SEMCLASS, null);
     nv.setType(stU);
   } catch (UnifyFailure uf) {
     throw new TypePropagationException(st, SEMCLASS);
   }
 }
Example #2
0
 public void modify(Mutable m) {
   if (m instanceof NominalVar) {
     NominalVar nv = (NominalVar) m;
     SimpleType st = nv.getType();
     SimpleType st0 = nomvarMap.get(nv);
     // add type to map if no type found
     if (st0 == null) {
       nomvarMap.put(nv, st);
       return;
     }
     // check equality
     if (st.equals(st0)) return;
     // otherwise unify types, update nv and map
     try {
       SimpleType stU = (SimpleType) st.unify(st0, null);
       nv.setType(stU);
       nomvarMap.put(nv, stU);
     } catch (UnifyFailure uf) {
       throw new TypePropagationException(st, st0);
     }
   }
 }