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


C# BaseFilter.AcceptableChoice方法代码示例

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


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

示例1: 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

示例2: 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 (filter.AcceptableChoice(Ref))
     {
         retVal.Add(Ref);
     }
 }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:12,代码来源:Designator.cs

示例3: 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

示例4: 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

示例5: Filter

        /// <summary>
        ///     Filters out value according to predicate
        /// </summary>
        /// <param name="accept"></param>
        public void Filter(BaseFilter accept)
        {
            ApplyUpdates();
            DiscardRemoved();

            // Only keep the most specific elements.
            string mostSpecific = null;
            foreach (ReturnValueElement element in Values)
            {
                if (accept.AcceptableChoice(element.Value))
                {
                    if (mostSpecific == null)
                    {
                        mostSpecific = element.Value.FullName;
                    }
                    else
                    {
                        if (mostSpecific.Length < element.Value.FullName.Length)
                        {
                            mostSpecific = element.Value.FullName;
                        }
                    }
                }
            }

            // if the filtering is about variables, ensure that there is at least one variable in the element chain
            if (accept is IsVariable)
            {
                List<ReturnValueElement> tmp = new List<ReturnValueElement>();
                foreach (ReturnValueElement element in Values)
                {
                    bool variableFound = false;
                    bool onlyStructureElement = true;
                    ReturnValueElement current = element;
                    while (!variableFound && current != null)
                    {
                        variableFound = IsStrictVariableOrValue.INSTANCE.AcceptableChoice(current.Value) ||
                                        current.AsType;
                        onlyStructureElement = onlyStructureElement && current.Value is StructureElement;
                        current = current.PreviousElement;
                    }

                    if (variableFound)
                    {
                        tmp.Add(element);
                    }
                    else if (onlyStructureElement)
                    {
                        tmp.Add(element);
                    }
                }

                // HaCK : If tmp is empty, this indicates that the filter above is too restrictive.
                // Keep the original set
                if (tmp.Count > 0)
                {
                    Values = tmp;
                }
            }

            // Build a new list with the filtered out elements
            bool variable = false;
            {
                List<ReturnValueElement> tmp = new List<ReturnValueElement>();
                foreach (ReturnValueElement element in Values)
                {
                    if (accept.AcceptableChoice(element.Value) &&
                        (mostSpecific == null || mostSpecific.Equals(element.Value.FullName)))
                    {
                        tmp.Add(element);
                        variable = variable || element.Value is IVariable;
                    }
                }
                Values = tmp;
            }

            // HaCK : If both Variable and StructureElement are found, only keep the variable
            if (variable)
            {
                List<ReturnValueElement> tmp = new List<ReturnValueElement>();
                foreach (ReturnValueElement element in Values)
                {
                    if (!(element.Value is StructureElement) && !(element.Value is Type))
                    {
                        tmp.Add(element);
                    }
                }

                Values = tmp;
            }
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:95,代码来源:ReturnValue.cs


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