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


C# IASTNode.GetChild方法代码示例

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


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

示例1: BuildPath

        private static void BuildPath(IASTNode node, StringBuilder sb)
        {
            if (node.Type == HqlSqlWalker.DOT)
            {
                BuildPath(node.GetChild(0), sb);

                sb.Append('.');
                sb.Append(node.GetChild(1).Text);
            }
            else
            {
                sb.Append(node.Text);
            }
        }
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:14,代码来源:PolymorphicQuerySourceDetector.cs

示例2: GetPathText

		private static void GetPathText(StringBuilder buf, IASTNode n)
		{
			IASTNode firstChild = n.GetChild(0);

			// If the node has a first child, recurse into the first child.
			if (firstChild != null)
			{
				GetPathText(buf, firstChild);
			}

			// Append the text of the current node.
			buf.Append(n.Text);

			// If there is a second child (RHS), recurse into that child.
			if (firstChild != null && n.ChildCount > 1)
			{
				GetPathText(buf, n.GetChild(1));
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:19,代码来源:ASTUtil.cs

示例3: TraverseDepthFirst

		/// <summary>
		/// Traverse the AST tree depth first. Note that the AST passed in is not visited itself.  Visitation starts
		/// with its children.
		/// </summary>
		/// <param name="ast">ast</param>
		public void TraverseDepthFirst(IASTNode ast)
		{
			if (ast == null)
			{
				throw new ArgumentNullException("ast");
			}

			for (int i = 0; i < ast.ChildCount; i++)
			{
				VisitDepthFirst(ast.GetChild(i));
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:17,代码来源:NodeTraverser.cs

示例4: VisitDepthFirst

		private void VisitDepthFirst(IASTNode ast)
		{
			if (ast == null)
			{
				return;
			}

			_visitor.Visit(ast);

			for (int i = 0; i < ast.ChildCount; i++)
			{
				VisitDepthFirst(ast.GetChild(i));
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:14,代码来源:NodeTraverser.cs

示例5: IsSubtreeChild

		/// <summary>
		/// Determine if a given node (test) is contained anywhere in the subtree
		/// of another given node (fixture).
		/// </summary>
		/// <param name="fixture">The node against which to be checked for children.</param>
		/// <param name="test">The node to be tested as being a subtree child of the parent.</param>
		/// <returns>True if child is contained in the parent's collection of children.</returns>
		public static bool IsSubtreeChild(IASTNode fixture, IASTNode test)
		{
			for (int i = 0; i < fixture.ChildCount; i++)
			{
				IASTNode n = fixture.GetChild(i);

				if (n == test)
				{
					return true;
				}
				if (n.ChildCount > 0 && IsSubtreeChild(n, test))
				{
					return true;
				}
			}
			return false;
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:24,代码来源:ASTUtil.cs

示例6: ProcessMemberOf

		public IASTNode ProcessMemberOf(IToken n, IASTNode p, IASTNode root)
		{
			ASTFactory factory = new ASTFactory(adaptor);

			return factory.CreateNode(n == null ? IN : NOT_IN,
			                          n == null ? "in" : "not in",
			                          root.IsNil && root.ChildCount == 1 ? root.GetChild(0) : root,
			                          factory.CreateNode(IN_LIST, "inList",
			                                             CreateSubquery(p)));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:10,代码来源:HqlParser.cs

示例7: NegateNode

		public IASTNode NegateNode(IASTNode node)
		{
			// TODO - copy code from HqlParser.java
			switch (node.Type)
			{
				case OR:
					node.Type = AND;
					node.Text = "{and}";
					NegateNode(node.GetChild(0));
					NegateNode(node.GetChild(1));
					return node;
				case AND:
					node.Type = OR;
					node.Text = "{or}";
					NegateNode(node.GetChild(0));
					NegateNode(node.GetChild(1));
					return node;
				case EQ:
					node.Type = NE;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (EQ a b) ) => (NE a b)
				case NE:
					node.Type = EQ;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (NE a b) ) => (EQ a b)
				case GT:
					node.Type = LE;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (GT a b) ) => (LE a b)
				case LT:
					node.Type = GE;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (LT a b) ) => (GE a b)
				case GE:
					node.Type = LT;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (GE a b) ) => (LT a b)
				case LE:
					node.Type = GT;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (LE a b) ) => (GT a b)
				case LIKE:
					node.Type = NOT_LIKE;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (LIKE a b) ) => (NOT_LIKE a b)
				case NOT_LIKE:
					node.Type = LIKE;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (NOT_LIKE a b) ) => (LIKE a b)
				case IN:
					node.Type = NOT_IN;
					node.Text = "{not}" + node.Text;
					return node;
				case NOT_IN:
					node.Type = IN;
					node.Text = "{not}" + node.Text;
					return node;
				case IS_NULL:
					node.Type = IS_NOT_NULL;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (IS_NULL a b) ) => (IS_NOT_NULL a b)
				case IS_NOT_NULL:
					node.Type = IS_NULL;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (IS_NOT_NULL a b) ) => (IS_NULL a b)
				case BETWEEN:
					node.Type = NOT_BETWEEN;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (BETWEEN a b) ) => (NOT_BETWEEN a b)
				case NOT_BETWEEN:
					node.Type = BETWEEN;
					node.Text = "{not}" + node.Text;
					return node;	// (NOT (NOT_BETWEEN a b) ) => (BETWEEN a b)
				/* This can never happen because this rule will always eliminate the child NOT.
							case NOT:
								return x.getFirstChild();			// (NOT (NOT x) ) => (x)
				*/
				default:
					IASTNode not = (IASTNode) TreeAdaptor.Create(NOT, "not");
					not.AddChild(node);
					return not;
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:83,代码来源:HqlParser.cs

示例8: CreateSelectClauseFromFromClause

		private void CreateSelectClauseFromFromClause(IASTNode qn)
		{
			// TODO - check this.  Not *exactly* the same logic as the Java original
			qn.InsertChild(0, (IASTNode)adaptor.Create(SELECT_CLAUSE, "{derived select clause}"));

			_selectClause = ( SelectClause ) qn.GetChild(0);
			_selectClause.InitializeDerivedSelectClause( _currentFromClause );

			if ( log.IsDebugEnabled ) 
			{
				log.Debug( "Derived SELECT clause created." );
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:13,代码来源:HqlSqlWalker.cs

示例9: ExtractMutationTexts

		private static string[] ExtractMutationTexts(IASTNode operand, int count) 
		{
			if ( operand is ParameterNode ) 
			{
				return Enumerable.Repeat("?", count).ToArray();
			}
			if (operand is SqlNode)
			{
				string nodeText = operand.Text;

				if (nodeText.StartsWith("("))
				{
					nodeText = nodeText.Substring(1);
				}
				if (nodeText.EndsWith(")"))
				{
					nodeText = nodeText.Substring(0, nodeText.Length - 1);
				}
				string[] splits = nodeText.Split(new[] { ", " }, StringSplitOptions.None);

				if (count != splits.Length)
				{
					throw new HibernateException("SqlNode's text did not reference expected number of columns");
				}
				return splits;
			}
			if (operand.Type == HqlSqlWalker.VECTOR_EXPR) 
			{
				var rtn = new string[operand.ChildCount];

				for (int x = 0; x < operand.ChildCount; x++)
				{
					rtn[ x ] = operand.GetChild(x).Text;
				}
				return rtn;
			}
			throw new HibernateException( "dont know how to extract row value elements from node : " + operand );
		}
开发者ID:jeynnecool,项目名称:nhibernate-core,代码行数:38,代码来源:BinaryLogicOperatorNode.cs

示例10: Visit

		public void Visit(IASTNode node)
		{
			if ((node.Type == HqlSqlWalker.PARAM) || (node.Type == HqlSqlWalker.COLON))
			{
				string name = node.GetChild(0).Text;

				if (_parameterNames.Contains(name))
				{
					_nodes.Add(node);
				}
			}
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:12,代码来源:ExpressionQueryImpl.cs

示例11: DialectFunction

		private void DialectFunction(IASTNode exprList)
		{
			_function = SessionFactoryHelper.FindSQLFunction(_methodName);

			if (_function != null)
			{
			    IASTNode child = null;

                if (exprList != null)
                {
                    child = _methodName == "iif" ? exprList.GetChild(1) : exprList.GetChild(0);
                }

                DataType = SessionFactoryHelper.FindFunctionReturnType(_methodName, child);
			}
			//TODO:
			/*else {
				methodName = (String) getWalker().getTokenReplacements().get( methodName );
			}*/
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:20,代码来源:MethodNode.cs

示例12: ExtractMutationTexts

		private static string[] ExtractMutationTexts(IASTNode operand, int count) 
		{
			if ( operand is ParameterNode ) 
			{
				string[] rtn = new string[count];
				for ( int i = 0; i < count; i++ ) 
				{
					rtn[i] = "?";
				}
				return rtn;
			}
			else if ( operand.Type == HqlSqlWalker.VECTOR_EXPR ) 
			{
				string[] rtn = new string[operand.ChildCount];

				for (int x = 0; x < operand.ChildCount; x++)
				{
					rtn[ x++ ] = operand.GetChild(x).Text;
					
				}
				return rtn;
			}
			else if ( operand is SqlNode ) 
			{
				string nodeText = operand.Text;

				if ( nodeText.StartsWith( "(" ) ) 
				{
					nodeText = nodeText.Substring( 1 );
				}
				if ( nodeText.EndsWith( ")" ) ) 
				{
					nodeText = nodeText.Substring( 0, nodeText.Length - 1 );
				}
				String[] splits = StringHelper.Split( ", ", nodeText );

				if ( count != splits.Length ) 
				{
					throw new HibernateException( "SqlNode's text did not reference expected number of columns" );
				}
				return splits;
			}
			else
			{
				throw new HibernateException( "dont know how to extract row value elements from node : " + operand );
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:47,代码来源:BinaryLogicOperatorNode.cs

示例13: FindTypeInChildren

		/// <summary>
		/// Finds the first node of the specified type in the chain of children.
		/// </summary>
		/// <param name="parent">The parent</param>
		/// <param name="type">The type to find.</param>
		/// <returns>The first node of the specified type, or null if not found.</returns>
		public static IASTNode FindTypeInChildren(IASTNode parent, int type)
		{
			for (int i = 0; i < parent.ChildCount; i++)
			{
				var child = parent.GetChild(i);
				if (child.Type == type)
				{
					return child;
				}
			}
			return null;
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:18,代码来源:ASTUtil.cs

示例14: FindTypeInChildren

		/// <summary>
		/// Finds the first node of the specified type in the chain of children.
		/// </summary>
		/// <param name="parent">The parent</param>
		/// <param name="type">The type to find.</param>
		/// <returns>The first node of the specified type, or null if not found.</returns>
		public static IASTNode FindTypeInChildren(IASTNode parent, int type)
		{
			for (int i = 0; i < parent.ChildCount; i++)
			{
				if (parent.GetChild(i).Type == type)
				{
					return parent.GetChild(i);
				}
			}
			return null;
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:17,代码来源:ASTUtil.cs


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