当前位置: 首页>>代码示例>>C#>>正文


C# Filter.BaseFilter类代码示例

本文整理汇总了C#中DataDictionary.Interpreter.Filter.BaseFilter的典型用法代码示例。如果您正苦于以下问题:C# BaseFilter类的具体用法?C# BaseFilter怎么用?C# BaseFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BaseFilter类属于DataDictionary.Interpreter.Filter命名空间,在下文中一共展示了BaseFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Fill

 /// <summary>
 ///     Fills the list provided with the element matching the filter provided
 /// </summary>
 /// <param name="retVal">The list to be filled with the element matching the condition expressed in the filter</param>
 /// <param name="filter">The filter to apply</param>
 public override void Fill(List<INamable> retVal, BaseFilter filter)
 {
     if (filter.AcceptableChoice(Value))
     {
         retVal.Add(Value);
     }
 }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:12,代码来源:StringExpression.cs

示例2: SemanticAnalysis

        /// <summary>
        ///     Performs the semantic analysis of the expression
        /// </summary>
        /// <param name="instance">the reference instance on which this element should analysed</param>
        /// <paraparam name="expectation">Indicates the kind of element we are looking for</paraparam>
        /// <returns>True if semantic analysis should be continued</returns>
        public override bool SemanticAnalysis(INamable instance, BaseFilter expectation)
        {
            bool retVal = base.SemanticAnalysis(instance, expectation);

            if (retVal)
            {
                // Iterator expression
                IteratorExpression.SemanticAnalysis(instance, AllMatches.INSTANCE);
                StaticUsage.AddUsages(IteratorExpression.StaticUsage, Usage.ModeEnum.Read);
            }

            return retVal;
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:19,代码来源:ExpressionBasedListExpression.cs

示例3: SemanticAnalysis

        /// <summary>
        ///     Performs the semantic analysis of the expression
        /// </summary>
        /// <param name="instance">the reference instance on which this element should analysed</param>
        /// <param name="expectation">Indicates the kind of element we are looking for</param>
        /// <returns>True if semantic analysis should be continued</returns>
        public virtual bool SemanticAnalysis(INamable instance, BaseFilter expectation)
        {
            bool retVal = !SemanticAnalysisDone;

            if (retVal)
            {
                StaticUsage = new Usages();
                SemanticAnalysisDone = true;
            }

            return retVal;
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:18,代码来源:Expression.cs

示例4: addReference

        /// <summary>
        ///     Adds a reference which satisfies the provided expectation in the result set
        /// </summary>
        /// <param name="namable"></param>
        /// <param name="expectation"></param>
        /// <param name="asType">Indicates that we had to move from instance to type to perform the deferencing</param>
        /// <param name="resultSet"></param>
        private int addReference(INamable namable, BaseFilter expectation, bool asType, ReturnValue resultSet)
        {
            int retVal = 0;

            if (namable != null)
            {
                if (expectation.AcceptableChoice(namable))
                {
                    if (asType)
                    {
                        if (!(namable is IValue) && !(namable is Type))
                        {
                            resultSet.Add(namable);
                            retVal += 1;
                        }
                        else if (namable is State)
                        {
                            // TODO : Refactor model to avoid this
                            resultSet.Add(namable);
                            retVal += 1;
                        }
                    }
                    else
                    {
                        resultSet.Add(namable);
                        retVal += 1;
                    }
                }
            }

            return retVal;
        }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:39,代码来源:Designator.cs

示例5: GetReferences

        /// <summary>
        ///     Provides the possible references for this designator (only available during semantic analysis)
        /// </summary>
        /// <param name="instance">the instance on which this element should be found.</param>
        /// <param name="expectation">the expectation on the element found</param>
        /// <param name="lastElement">Indicates that this element is the last one in a dereference chain</param>
        /// <returns></returns>
        public ReturnValue GetReferences(INamable instance, BaseFilter expectation, bool lastElement)
        {
            ReturnValue retVal = new ReturnValue(this);

            if (instance == null)
            {
                // Special handling for THIS or ENCLOSING
                if (Image == ThisKeyword || Image == EnclosingKeyword)
                {
                    INamable currentElem = Root;
                    while (currentElem != null)
                    {
                        Type type = currentElem as Type;
                        if (type != null)
                        {
                            StateMachine stateMachine = type as StateMachine;
                            while (stateMachine != null)
                            {
                                type = stateMachine;
                                stateMachine = stateMachine.EnclosingStateMachine;
                            }

                            // Enclosing does not references state machines.
                            if (!(Image == EnclosingKeyword && type is StateMachine))
                            {
                                retVal.Add(type);
                                return retVal;
                            }
                        }
                        currentElem = enclosing(currentElem);
                    }

                    return retVal;
                }

                // No enclosing instance. Try to first name of a . separated list of names
                //  . First in the enclosing expression
                InterpreterTreeNode current = this;
                while (current != null)
                {
                    ISubDeclarator subDeclarator = current as ISubDeclarator;
                    if (FillBySubdeclarator(subDeclarator, expectation, false, retVal) > 0)
                    {
                        // If this is the last element in the dereference chain, stop at first match
                        if (lastElement)
                        {
                            return retVal;
                        }
                        current = null;
                    }
                    else
                    {
                        current = current.Enclosing;
                    }
                }

                // . In the predefined elements
                addReference(EfsSystem.Instance.GetPredefinedItem(Image), expectation, false, retVal);
                if (lastElement && !retVal.IsEmpty)
                {
                    return retVal;
                }

                // . In the enclosing items, except the enclosing dictionary since dictionaries are handled in a later step
                INamable currentNamable = Root;
                while (currentNamable != null)
                {
                    ISubDeclarator subDeclarator = currentNamable as ISubDeclarator;
                    if (subDeclarator != null && !(subDeclarator is Dictionary))
                    {
                        if (FillBySubdeclarator(subDeclarator, expectation, false, retVal) > 0 && lastElement)
                        {
                            return retVal;
                        }
                    }

                    currentNamable = EnclosingSubDeclarator(currentNamable);
                }

                // . In the dictionaries declared in the system
                foreach (Dictionary dictionary in EfsSystem.Instance.Dictionaries)
                {
                    if (FillBySubdeclarator(dictionary, expectation, false, retVal) > 0 && lastElement)
                    {
                        return retVal;
                    }

                    NameSpace defaultNameSpace = dictionary.FindNameSpace("Default");
                    if (defaultNameSpace != null)
                    {
                        if (FillBySubdeclarator(defaultNameSpace, expectation, false, retVal) > 0 && lastElement)
                        {
                            return retVal;
//.........这里部分代码省略.........
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:101,代码来源:Designator.cs

示例6: SemanticAnalysis

        /// <summary>
        ///     Performs the semantic analysis of the expression
        /// </summary>
        /// <param name="instance">the reference instance on which this element should analysed</param>
        /// <param name="expectation">Indicates the kind of element we are looking for</param>
        /// <returns>True if semantic analysis should be continued</returns>
        public override bool SemanticAnalysis(INamable instance, BaseFilter expectation)
        {
            bool retVal = base.SemanticAnalysis(instance, expectation);

            if (retVal)
            {
                // Structure
                if (Structure != null)
                {
                    Structure.SemanticAnalysis(instance, IsStructure.INSTANCE);
                    StaticUsage.AddUsages(Structure.StaticUsage, Usage.ModeEnum.Type);

                    // Structure field Association
                    if (Associations != null)
                    {
                        Structure structureType = Structure.Ref as Structure;
                        foreach (KeyValuePair<Designator, Expression> pair in Associations)
                        {
                            if (structureType != null)
                            {
                                pair.Key.Ref = structureType.FindStructureElement(pair.Key.Image);
                                StaticUsage.AddUsage(pair.Key.Ref, Root, Usage.ModeEnum.Parameter);
                            }

                            pair.Value.SemanticAnalysis(instance, IsRightSide.INSTANCE);
                            StaticUsage.AddUsages(pair.Value.StaticUsage, Usage.ModeEnum.Read);
                        }
                    }
                }
            }

            return retVal;
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:39,代码来源:StructExpression.cs

示例7: SemanticAnalysis

        /// <summary>
        ///     Performs the semantic analysis of the expression
        /// </summary>
        /// <param name="instance">the reference instance on which this element should analysed</param>
        /// <param name="expectation">Indicates the kind of element we are looking for</param>
        /// <returns>True if semantic analysis should be continued</returns>
        public override bool SemanticAnalysis(INamable instance, BaseFilter expectation)
        {
            bool retVal = base.SemanticAnalysis(instance, expectation);

            if (retVal)
            {
                // Accumulator
                AccumulatorVariable.Type = GetExpressionType();

                if (DefinedAccumulator != null)
                {
                    DefinedAccumulator.SemanticAnalysis(instance, AllMatches.INSTANCE);

                    Accumulator.SemanticAnalysis(instance, AllMatches.INSTANCE);
                    StaticUsage.AddUsages(Accumulator.StaticUsage, Usage.ModeEnum.Read);
                }
                else
                {
                    AddError("Accumulator expression not provided", RuleChecksEnum.SemanticAnalysisError);
                }
            }

            return retVal;
        }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:30,代码来源:SumExpression.cs

示例8: GetReferenceTypes

        /// <summary>
        ///     Provides the possible references types for this expression (used in semantic analysis)
        /// </summary>
        /// <param name="instance">the reference instance on which this element should analysed</param>
        /// <param name="expectation">Indicates the kind of element we are looking for</param>
        /// <param name="last">indicates that this is the last element in a dereference chain</param>
        /// <returns></returns>
        public override ReturnValue GetReferenceTypes(INamable instance, BaseFilter expectation, bool last)
        {
            ReturnValue retVal = ReturnValue.Empty;

            if (Term != null)
            {
                retVal = Term.GetReferenceTypes(instance, expectation, last);
            }
            else
            {
                if (Expression != null)
                {
                    retVal = Expression.GetReferenceTypes(instance, expectation, true);
                }
            }

            return retVal;
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:25,代码来源:UnaryExpression.cs

示例9: SemanticAnalysis

 /// <summary>
 ///     Performs the semantic analysis of the term
 /// </summary>
 /// <param name="instance">the reference instance on which this element should analysed</param>
 /// <param name="expectation">Indicates the kind of element we are looking for</param>
 /// <param name="lastElement">Indicates that this element is the last one in a dereference chain</param>
 /// <returns>True if semantic analysis should be continued</returns>
 public void SemanticAnalysis(INamable instance, BaseFilter expectation, bool lastElement)
 {
     if (Designator != null)
     {
         Designator.SemanticAnalysis(instance, expectation, lastElement);
         StaticUsage = Designator.StaticUsage;
     }
     else if (LiteralValue != null)
     {
         LiteralValue.SemanticAnalysis(instance, expectation);
         StaticUsage = LiteralValue.StaticUsage;
     }
 }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:20,代码来源:Term.cs

示例10: GetReferenceTypes

        /// <summary>
        ///     Provides the possible references types for this expression (used in semantic analysis)
        /// </summary>
        /// <param name="instance">the reference instance on which this element should analysed</param>
        /// <param name="expectation">Indicates the kind of element we are looking for</param>
        /// <param name="last">indicates that this is the last element in a dereference chain</param>
        /// <returns></returns>
        public ReturnValue GetReferenceTypes(INamable instance, BaseFilter expectation, bool last)
        {
            ReturnValue retVal = null;

            if (Designator != null)
            {
                retVal = new ReturnValue();

                foreach (ReturnValueElement element in Designator.GetReferences(instance, expectation, last).Values)
                {
                    if (element.Value is Type)
                    {
                        const bool asType = true;
                        retVal.Add(element.Value, null, asType);
                    }
                }
            }
            else if (LiteralValue != null)
            {
                retVal = LiteralValue.GetReferenceTypes(instance, expectation, true);
            }

            return retVal;
        }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:31,代码来源:Term.cs

示例11: GetReferences

        /// <summary>
        ///     Provides the possible references for this term (only available during semantic analysis)
        /// </summary>
        /// <param name="instance">the instance on which this element should be found.</param>
        /// <param name="expectation">the expectation on the element found</param>
        /// <param name="last">indicates that this is the last element in a dereference chain</param>
        /// <returns></returns>
        public ReturnValue GetReferences(INamable instance, BaseFilter expectation, bool last)
        {
            ReturnValue retVal = null;

            if (Designator != null)
            {
                retVal = Designator.GetReferences(instance, expectation, last);
            }
            else if (LiteralValue != null)
            {
                retVal = LiteralValue.GetReferences(instance, expectation, last);
            }

            return retVal;
        }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:22,代码来源:Term.cs

示例12: Fill

 /// <summary>
 ///     Fills the list provided with the element matching the filter provided
 /// </summary>
 /// <param name="retVal">The list to be filled with the element matching the condition expressed in the filter</param>
 /// <param name="filter">The filter to apply</param>
 public void Fill(List<INamable> retVal, BaseFilter filter)
 {
     if (Designator != null)
     {
         Designator.Fill(retVal, filter);
     }
     else if (LiteralValue != null)
     {
         LiteralValue.Fill(retVal, filter);
     }
 }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:16,代码来源:Term.cs

示例13: SemanticAnalysis

        /// <summary>
        ///     Performs the semantic analysis of the expression
        /// </summary>
        /// <param name="instance">the reference instance on which this element should analysed</param>
        /// <param name="expectation">Indicates the kind of element we are looking for</param>
        /// <returns>True if semantic analysis should be continued</returns>
        public override bool SemanticAnalysis(INamable instance, BaseFilter expectation)
        {
            bool retVal = base.SemanticAnalysis(instance, expectation);

            if (retVal)
            {
                if (Expression != null)
                {
                    Expression.SemanticAnalysis(instance, AllMatches.INSTANCE);
                    StaticUsage.AddUsages(Expression.StaticUsage, null);
                }
                else
                {
                    AddError("Function body not provided");
                }
            }

            return retVal;
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:25,代码来源:FunctionExpression.cs

示例14: Fill

        /// <summary>
        ///     Fills the list provided with the element matching the filter provided
        /// </summary>
        /// <param name="retVal">The list to be filled with the element matching the condition expressed in the filter</param>
        /// <param name="filter">The filter to apply</param>
        public override void Fill(List<INamable> retVal, BaseFilter filter)
        {
            if (Parameters != null)
            {
                foreach (Parameter parameter in Parameters)
                {
                    if (filter.AcceptableChoice(parameter))
                    {
                        retVal.Add(parameter);
                    }
                }
            }

            if (Expression != null)
            {
                Expression.Fill(retVal, filter);
            }
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:23,代码来源:FunctionExpression.cs

示例15: SemanticAnalysis

        /// <summary>
        ///     Performs the semantic analysis of the expression
        /// </summary>
        /// <param name="instance">the reference instance on which this element should analysed</param>
        /// <paraparam name="expectation">Indicates the kind of element we are looking for</paraparam>
        /// <returns>True if semantic analysis should be continued</returns>
        public override bool SemanticAnalysis(INamable instance, BaseFilter expectation)
        {
            bool retVal = base.SemanticAnalysis(instance, expectation);

            if (retVal)
            {
                Ref = null;

                ReturnValue tmp = getReferences(instance, expectation, false);

                if (tmp.IsUnique)
                {
                    // Unique element has been found. Reference it and perform the semantic analysis
                    // on all dereferenced expression, now that the context is known for each expression
                    Ref = tmp.Values[0].Value;
                    StaticUsage.AddUsage(Ref, Root, null);

                    References referenceFilter;
                    ReturnValueElement current = tmp.Values[0];
                    for (int i = Arguments.Count - 1; i > 0; i--)
                    {
                        referenceFilter = new References(current.Value);
                        current = current.PreviousElement;
                        Arguments[i].SemanticAnalysis(current.Value, referenceFilter);
                        StaticUsage.AddUsages(Arguments[i].StaticUsage, null);
                        StaticUsage.AddUsage(Arguments[i].Ref, Root, null);
                    }
                    referenceFilter = new References(current.Value);
                    Arguments[0].SemanticAnalysis(null, referenceFilter);
                    StaticUsage.AddUsages(Arguments[0].StaticUsage, null);
                    StaticUsage.AddUsage(Arguments[0].Ref, Root, null);
                }
                else if (tmp.IsAmbiguous)
                {
                    // Several possible interpretations for this deref expression, not allowed
                    AddError("Expression " + ToString() + " may have several interpretations " + tmp.ToString() +
                             ", please disambiguate");
                }
                else
                {
                    // No possible interpretation for this deref expression, not allowed
                    AddError("Expression " + ToString() + " has no interpretation");
                }
            }

            return retVal;
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:53,代码来源:DerefExpression.cs


注:本文中的DataDictionary.Interpreter.Filter.BaseFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。