Exemplo n.º 1
0
Arquivo: App.cs Projeto: hwacha/SemInC
    public App(LogicalForm f, LogicalForm x) : base(null)
    {
        ISemanticType fType = f.GetSemanticType();
        ISemanticType xType = x.GetSemanticType();

        if (fType.GetType() != typeof(Arrow))
        {
            System.Console.WriteLine(
                "App failed: function argument not function type");
            return;
        }
        Arrow aType = (Arrow)fType;

        if (!aType.GetInputType().Equals(xType))
        {
            // error
            System.Console.WriteLine("App failed: type mismatch");
            // throw new InvalidTypeException();
            return;
        }

        this.type = aType.GetOutputType();

        this.isFormula = this.type.GetType() == typeof(T);

        this.freeVariables = f.MergeVariables(x);

        this.f = f;
        this.x = x;
    }
Exemplo n.º 2
0
    public ModelBind(LogicalForm sentence, LogicalForm model)
        : base(new TWG())
    {
        if (!sentence.IsFormula())
        {
            // error!
        }
        if (model.GetType() != typeof(Model))
        {
            // error!
        }
        this.sentence = sentence;

        this.model = model;

        this.isFormula     = false;
        this.freeVariables = sentence.MergeVariables(model);
    }