Example #1
0
        private static ConditionBase GetCondition(XElement conditionElement)
        {
            string     name             = conditionElement.Attribute("operator").Value;
            string     morphemeLocation = conditionElement.Attribute("morpheme").Value;
            XAttribute attribute        = conditionElement.Attribute("operand");
            string     operand          = "";

            if (attribute != null)
            {
                operand = attribute.Value;
            }
            return(ConditionFactory.Create(name, morphemeLocation, operand, _alphabet));
        }
        private ConditionBase GetCondition(XElement conditionElement)
        {
            var name             = conditionElement.Attribute("operator").Value;
            var morphemePosition = conditionElement.Attribute("morpheme").Value;
            var attribute        = conditionElement.Attribute("operand");
            var operand          = "";

            if (attribute != null)
            {
                operand = attribute.Value;
            }
            return(ConditionFactory.Create(name, morphemePosition, operand, _alphabet));
        }
Example #3
0
        private ConditionBase ReadCondition(XmlNode node)
        {
            var name = node.Attributes["operator"].InnerText;

            var morpheme = node.Attributes["morpheme"].InnerText;

            var operand = string.Empty;

            if (node.Attributes["operand"] != null)
            {
                operand = node.Attributes["operand"].InnerText;
            }

            return(ConditionFactory.Create(name, morpheme, operand, _alphabet));
        }
Example #4
0
    public INode CreateTestNode7()
    {
        NodeFactory      factory          = FactoryManager.Instance.GetFactory <NodeFactory>(FactoryType.Node);
        ConditionFactory conditionFactory = FactoryManager.Instance.GetFactory <ConditionFactory>(FactoryType.Condition);

        var rootNode        = factory.Create <RootNode>(NodeType.Root);
        var sequencerNode   = factory.Create <SequencerNode>(NodeType.Sequencer);
        var actionNode1     = CreateSampleActionNode1();
        var conditionNode   = factory.Create <ConditionWhileNode>(NodeType.ConditionWhile);
        var repeatCondition = conditionFactory.Create <RepeatCondition>(ConditionType.Repeat);

        repeatCondition.LoopCount = 3;
        conditionNode.Condition   = repeatCondition;
        conditionNode.AddNode(sequencerNode);
        sequencerNode.AddNode(actionNode1);
        rootNode.AddNode(conditionNode);
        return(rootNode);
    }