Пример #1
0
        /// <summary>
        /// Creates a function which gets the field named "fieldName" from one of the subfield of the structure provided as parameter
        /// </summary>
        /// <param name="nameSpace">The namespace in which the function should be created</param>
        /// <param name="structure">The structure which should be looked for</param>
        /// <param name="subField">The name of the subfield to look for</param>
        /// <param name="returnType">The function return type</param>
        private void AppendGetFunction(DataDictionary.Types.NameSpace nameSpace, DataDictionary.Types.Structure structure, string subField, string returnType)
        {
            DataDictionary.Functions.Function getFunction = (DataDictionary.Functions.Function)DataDictionary.Generated.acceptor.getFactory().createFunction();
            getFunction.Name = subField;
            getFunction.setTypeName(returnType);

            DataDictionary.Parameter param = (DataDictionary.Parameter)DataDictionary.Generated.acceptor.getFactory().createParameter();
            param.Name     = "msg";
            param.TypeName = structure.Name;
            getFunction.appendParameters(param);

            foreach (DataDictionary.Types.StructureElement element in structure.Elements)
            {
                DataDictionary.Functions.Case     cas       = (DataDictionary.Functions.Case)DataDictionary.Generated.acceptor.getFactory().createCase();
                DataDictionary.Rules.PreCondition condition = (DataDictionary.Rules.PreCondition)DataDictionary.Generated.acceptor.getFactory().createPreCondition();
                condition.Expression = "msg." + element.Name + " != EMPTY";

                cas.appendPreConditions(condition);
                cas.ExpressionText = "msg." + element.Name + "." + subField;

                getFunction.appendCases(cas);
            }

            nameSpace.appendFunctions(getFunction);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="item"></param>
 /// <param name="children"></param>
 public PreConditionsTreeNode(DataDictionary.Functions.Case item)
     : base(item, "Pre condition", true)
 {
     foreach (DataDictionary.Rules.PreCondition preCondition in item.PreConditions)
     {
         Nodes.Add(new DataDictionaryView.PreConditionTreeNode(preCondition));
     }
 }
Пример #3
0
        /// <summary>
        /// Adds a new case
        /// </summary>
        /// <param name="function"></param>
        public CaseTreeNode AddCase(DataDictionary.Functions.Case aCase)
        {
            Item.appendCases(aCase);
            CaseTreeNode retVal = new CaseTreeNode(aCase);

            Nodes.Add(retVal);

            return(retVal);
        }
Пример #4
0
        /// <summary>
        ///     Creates a precondition in the enclosing function case
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected PreCondition CreatePreCondition(Case enclosing, string name)
        {
            PreCondition retVal = (PreCondition)Factory.createPreCondition();

            enclosing.appendPreConditions(retVal);
            retVal.ExpressionText = name;

            return(retVal);
        }
Пример #5
0
        public void AddHandler(object sender, EventArgs args)
        {
            DataDictionaryTreeView treeView = BaseTreeView as DataDictionaryTreeView;

            if (treeView != null)
            {
                DataDictionary.Functions.Case aCase = (DataDictionary.Functions.Case)DataDictionary.Generated.acceptor.getFactory().createCase();
                aCase.Name = "<Case" + (GetNodeCount(false) + 1) + ">";
                AddCase(aCase);
            }
        }
Пример #6
0
        /// <summary>
        /// Create structure based on the subsystem structure
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is CaseTreeNode)
            {
                CaseTreeNode node = SourceNode as CaseTreeNode;
                DataDictionary.Functions.Case aCase = node.Item;
                node.Delete();
                AddCase(aCase);
            }
        }
Пример #7
0
        /// <summary>
        ///     Creates a case in the enclosing function
        /// </summary>
        /// <param name="function"></param>
        /// <param name="name"></param>
        /// <param name="expression"></param>
        /// <param name="preConditionExpression"></param>
        /// <returns></returns>
        protected Case CreateCase(Function function, string name, string expression, string preConditionExpression = "")
        {
            Case retVal = (Case)Factory.createCase();

            function.appendCases(retVal);
            retVal.Name           = name;
            retVal.ExpressionText = expression;

            if (preConditionExpression != "")
            {
                PreCondition preCondition = (PreCondition)Factory.createPreCondition();
                preCondition.ExpressionText = preConditionExpression;
                retVal.appendPreConditions(preCondition);
            }

            return(retVal);
        }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="item"></param>
 /// <param name="buildSubNodes"></param>
 public PreConditionsTreeNode(Case item, bool buildSubNodes)
     : base(item, buildSubNodes, "Pre condition", true)
 {
 }
        /// <summary>
        ///     Creates a precondition in the enclosing function case
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected PreCondition CreatePreCondition(Case enclosing, string name)
        {
            PreCondition retVal = (PreCondition) Factory.createPreCondition();
            enclosing.appendPreConditions(retVal);
            retVal.ExpressionText = name;

            return retVal;
        }