Пример #1
0
    // Super compatible
    private HashSet <int> GetDomain(ISemanticType t)
    {
        Model currentModel = super;

        if (t.GetType() == typeof(FType))
        {
            FType       fType   = (FType)t;
            LogicalForm formula = fType.GetFormula();
            int         varID   = formula.GetFreeVariables().Single <Variable>().GetID();

            ISemanticType baseType = fType.GetBaseType();

            // populating the set with all semantic values
            // (including those in super models)
            // possible error: basetype is undefined in M
            Dictionary <int, ISemanticValue> .KeyCollection baseSet = model[baseType].Keys;

            while (currentModel != null)
            {
                // possible error: basetype is undefined in M
                baseSet.Union <int>(currentModel.model[baseType].Keys);
            }

            HashSet <int> finalSet = new HashSet <int>();

            foreach (int i in baseSet)
            {
                if (Satisfies(formula.Bind(varID, new Constant(baseType, i))))
                {
                    finalSet.Add(i);
                }
            }
            return(finalSet);
        }

        HashSet <int> theSet = new HashSet <int>();

        foreach (int i in model[t].Keys)
        {
            theSet.Add(i);
        }

        while (currentModel != null)
        {
            // possible error: t is undefined in M
            theSet.UnionWith(currentModel.model[t].Keys);
        }

        return(theSet);
    }
Пример #2
0
 public LogicalForm Apply(LogicalForm x)
 {
     return(l.Bind(v.GetID(), x));
 }
Пример #3
0
 public override LogicalForm Bind(int id, LogicalForm l)
 {
     return(new ToTruth(sentence.Bind(id, l)));
 }
Пример #4
0
 public override LogicalForm Bind(int id, LogicalForm l)
 {
     return(new App(f.Bind(id, l), x.Bind(id, l)));
 }
Пример #5
0
 public override LogicalForm Bind(int id, LogicalForm l)
 {
     return(new ModelBind(sentence.Bind(id, l), model.Bind(id, l)));
 }
Пример #6
0
 public override LogicalForm Bind(int id, LogicalForm l)
 {
     return(new Not(sub.Bind(id, l)));
 }
Пример #7
0
 public override LogicalForm Bind(int id, LogicalForm l)
 {
     return(new ToDesirability(sentence.Bind(id, l)));
 }