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


C# INamable类代码示例

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


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

示例1: ExplanationPart

 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="element">The element for which this explanation part is created</param>
 /// <param name="leftPart">The left path to associate to this explanation</param>
 /// <param name="rightPart">The value associate to this left part</param>
 public ExplanationPart(ModelElement element, object leftPart, INamable rightPart = null)
 {
     Element = element;
     LeftPart = leftPart;
     RightPart = rightPart;
     SubExplanations = new List<ExplanationPart>();
 }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:13,代码来源:ExplanationPart.cs

示例2: ModelEvent

 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="id"></param>
 /// <param name="instance"></param>
 /// <param name="priority"></param>
 public ModelEvent(string id, INamable instance, acceptor.RulePriority? priority)
 {
     Id = id;
     Message = id;
     Instance = instance;
     Priority = priority;
 }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:13,代码来源:ModelEvents.cs

示例3: AcceptableChoice

        /// <summary>
        ///     Predicate which indicates whether the namable provided matches the expectation for the semantic analysis
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public override bool AcceptableChoice(INamable value)
        {
            bool retVal = base.AcceptableChoice(value);

            if (!retVal)
            {
                retVal = IsCallable.Predicate(value);
            }

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

示例4: AcceptableChoice

        /// <summary>
        ///     Predicate which indicates whether the namable provided matches the expectation for the semantic analysis
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public override bool AcceptableChoice(INamable value)
        {
            bool retVal = base.AcceptableChoice(value);

            if (!retVal)
            {
                return value is Parameter;
            }

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

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

示例6: Rename

        public Rename( INamable Target, string Title, bool ReadOnly )
            : this()
        {
            NamingTarget = Target;
            NewName.Text = Target.Name;
            NewName.IsReadOnly = ReadOnly;

            NewName.SelectAll();

            if ( !string.IsNullOrEmpty( Title ) )
            {
                TitleBlock.Text = Title;
            }
        }
开发者ID:tgckpg,项目名称:wenku10,代码行数:14,代码来源:Rename.xaml.cs

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

示例8: explainNamable

        /// <summary>
        ///     Provides the textual representation of the namable provided
        /// </summary>
        /// <param name="namable"></param>
        /// <returns></returns>
        private string explainNamable(INamable namable)
        {
            string retVal = "";

            if (namable != null)
            {
                retVal = namable.Name;

                Function fonction = namable as Function;
                if (fonction != null)
                {
                    if (fonction.Graph != null)
                    {
                        retVal = fonction.Graph.ToString();
                    }
                    else if (fonction.Surface != null)
                    {
                        retVal = fonction.Surface.ToString();
                    }
                }
                else
                {
                    IValue value = namable as IValue;
                    if (value != null)
                    {
                        retVal = value.LiteralName;
                    }
                }
            }

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

示例9: SemanticAnalysis

        /// <summary>
        ///     Performs the semantic analysis of the statement
        /// </summary>
        /// <param name="instance">the reference instance on which this element should analysed</param>
        /// <returns>True if semantic analysis should be continued</returns>
        public override bool SemanticAnalysis(INamable instance = null)
        {
            bool retVal = base.SemanticAnalysis(instance);

            if (retVal)
            {
                // ListExpression
                if (ListExpression != null)
                {
                    ListExpression.SemanticAnalysis(instance);
                    StaticUsage.AddUsages(ListExpression.StaticUsage, Usage.ModeEnum.ReadAndWrite);

                    Collection collectionType = ListExpression.GetExpressionType() as Collection;
                    if (collectionType != null)
                    {
                        IteratorVariable.Type = collectionType.Type;
                    }
                }
                else
                {
                    AddError("List expression not provided");
                }

                // Condition
                if (Condition != null)
                {
                    Condition.SemanticAnalysis(instance);
                    StaticUsage.AddUsages(Condition.StaticUsage, Usage.ModeEnum.Read);
                }
            }

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

示例10: EnclosingSubDeclarator

        /// <summary>
        ///     Provides the enclosing sub declarator
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        private INamable EnclosingSubDeclarator(INamable instance)
        {
            INamable retVal = instance;

            do
            {
                retVal = enclosing(retVal);
            } while (retVal != null && !(retVal is ISubDeclarator));

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

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

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

示例13: Predicate

 /// <summary>
 ///     Predicate, so that the code can be reused
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static bool Predicate(INamable value)
 {
     return value is Type;
 }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:9,代码来源:IsType.cs

示例14: Predicate

 /// <summary>
 ///     Predicate, so that the code can be reused
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static bool Predicate(INamable value)
 {
     return (value is IValue);
 }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:9,代码来源:IsLiteral.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>
        /// <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
                if (AccumulatorVariable != null)
                {
                    AccumulatorVariable.Type = GetExpressionType();
                }

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

                if (Accumulator != null)
                {
                    Accumulator.SemanticAnalysis(instance, AllMatches.INSTANCE);
                    StaticUsage.AddUsages(Accumulator.StaticUsage, Usage.ModeEnum.Read);
                }
            }

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


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