예제 #1
0
 public List<ExpressionLeaf> GetLeafNodes(AExpression parent = null)
 {
     var result = new List<ExpressionLeaf>();
     Parent = parent;
     GetLeafNode(Left, ref result);
     GetLeafNode(Right, ref result);
     return result;
 }
예제 #2
0
 private void GetLeafNode(AExpression expr,  ref List<ExpressionLeaf> result)
 {
     var exprLeaf = expr as ExpressionLeaf;
     if (exprLeaf == null)
     {
         result.AddRange(expr.GetLeafNodes(this));
     }
     else 
     {
         result.Add(exprLeaf);
     }
 }
예제 #3
0
 public AExpression(BaseKnowledge left, string op, BaseKnowledge right)
 {
     if (left != null)
     {
         var l = left as AExpression;
         Left = l ?? new ExpressionLeaf(left);
     }
     Operator = op;
     if (right != null)
     {
         var r = right as AExpression;
         Right = r ?? new ExpressionLeaf(right);
     }
 }