예제 #1
0
 public void modify(Mutable m) {
   if (m instanceof Proposition) {
     Proposition prop = (Proposition) m;
     if (prop.getName().equals(DEFAULT_VAL)) prop.setAtomName(REPLACEMENT);
   } else if (m instanceof FeatureStructure) {
     FeatureStructure fs = (FeatureStructure) m;
     for (Iterator<String> it = fs.getAttributes().iterator(); it.hasNext(); ) {
       String attr = it.next();
       Object val = fs.getValue(attr);
       if (val instanceof SimpleType && ((SimpleType) val).getName().equals(DEFAULT_VAL)) {
         fs.setFeature(attr, grammar.types.getSimpleType(REPLACEMENT));
       }
     }
   }
 }
예제 #2
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);
   }
 }