示例#1
0
        //规则:Robert 和 John 是男性
        public static Expression getMaleExpression()
        {
            Expression robert = new TerminalExpression("Robert");
            Expression john   = new TerminalExpression("John");

            return(new OrExpression(robert, john));
        }
示例#2
0
        //规则:Julie 是一个已婚的女性
        public static Expression getMarriedWomanExpression()
        {
            Expression julie   = new TerminalExpression("Julie");
            Expression married = new TerminalExpression("Married");

            return(new AndExpression(julie, married));
        }
示例#3
0
        public Context()
        {
            Expression city   = new TerminalExpression(citys);
            Expression person = new TerminalExpression(persons);

            cityPerson = new NonTerminalExpression(city, person);
        }