Ejemplo n.º 1
0
 [AgRule("Render", "Group")] static bool GroupRender(Ast n)
 {
     foreach (Ast c in n.GetBody().Children())
     {
         if (c.IsShown())
         {
             c.Render();
             c.Widget().Show();
         }
         else
         {
             c.Widget().Hide();
         }
     }
     n.Widget().Show();
     return(true);
 }
Ejemplo n.º 2
0
 static bool GroupRender(Racr.AstNode n)
 {
     foreach (var c in n.GetBody().Children())
     {
         var child = c as Racr.AstNode;
         var w     = child.Widget();
         child.Render();
         if (child.IsShown())
         {
             w.Show();
         }
         else
         {
             child.Widget().Hide();
         }
     }
     return(true);
 }
Ejemplo n.º 3
0
    private static void UpdateQuestions(Ast n)
    {
        switch (n.NodeType())
        {
        case "Form":
        case "Group":
            foreach (var c in n.GetBody().Children())
            {
                UpdateQuestions(c as Ast);
            }
            break;

        case "ComputedQuestion":
            break;

        default:
            n.Dialog().SetValue(n.Value());
            break;
        }
    }
Ejemplo n.º 4
0
    static public void UpdateQuestions(Racr.AstNode n)
    {
        switch (n.NodeType())
        {
        case "Form":
        case "Group":
            foreach (var c in n.GetBody().Children())
            {
                UpdateQuestions(c as Racr.AstNode);
            }
            break;

        case "ComputedQuestion":
            break;

        default:
            (n.Widget() as Widget).Set(n.Value());
            break;
        }
    }
Ejemplo n.º 5
0
 [AgRule("SExpr", "Group")] static string GroupSExpr(Ast n)
 {
     return("(If " + n.GetExpression().SExpr() + " " +
            String.Join(" ", n.GetBody().Children().Select(x => ((Ast)x).SExpr())) + ")");
 }
Ejemplo n.º 6
0
    // Persistency:

    [AgRule("SExpr", "Form")] static string FormSExpr(Ast n)
    {
        return("(Form " + String.Join(" ",
                                      n.GetBody().Children().Skip(1).Select(x => ((Ast)x).SExpr())) + ")");
    }
Ejemplo n.º 7
0
 [AgRule("IsValid", "Group")] static bool GroupIsValid(Ast n)
 {
     return(n.IsLValid() && n.GetBody().Children().All(x => ((Ast)x).IsValid()));
 }
Ejemplo n.º 8
0
    // Well-formedness:

    [AgRule("IsValid", "Form")] static bool FormIsValid(Ast n)
    {
        return(n.GetBody().Children(new Racr.Range(2)).All(x => ((Ast)x).IsValid()));
    }
Ejemplo n.º 9
0
 [AgRule("LLookup", "Group")] static Ast GroupLLookup(Ast n, string name)
 {
     return(findL(name, n.GetBody(), n.GetBody().NumChildren()));
 }
Ejemplo n.º 10
0
 [AgRule("ErrorQuestion", "Form")] static Ast FormErrorQuestion(Ast n)
 {
     return(n.GetBody().Child(1));
 }
Ejemplo n.º 11
0
 static bool FormIsValid(Racr.AstNode n)
 {
     return(n.GetBody().Children(new Racr.Range(2)).All(x => ((Racr.AstNode)x).IsValid()));
 }
Ejemplo n.º 12
0
 static Racr.AstNode FormErrorQuestion(Racr.AstNode n)
 {
     return(n.GetBody().Child(1));
 }
Ejemplo n.º 13
0
 static string GroupSExpr(Racr.AstNode n)
 {
     return("(If " + n.GetExpression().SExpr() + " " + String.Join(" ", n.GetBody().Children().Select(x => ((Racr.AstNode)x).SExpr())) + ")");
 }
Ejemplo n.º 14
0
 static string FormSExpr(Racr.AstNode n)
 {
     return("(Form " + String.Join(" ", n.GetBody().Children().Skip(1).Select(x => ((Racr.AstNode)x).SExpr())) + ")");
 }
Ejemplo n.º 15
0
 static bool GroupIsValid(Racr.AstNode n)
 {
     return(n.IsLValid() && n.GetBody().Children().All(x => ((Racr.AstNode)x).IsValid()));
 }
Ejemplo n.º 16
0
 static Racr.AstNode GroupLLookup(Racr.AstNode n, string name)
 {
     return(findL(name, n.GetBody(), n.GetBody().NumChildren()));
 }