⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 valuenodelist.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
									getClassFactory()))			{				throw StandardException.newException(SQLState.LANG_NOT_COMPARABLE, 						leftType.getSQLTypeName(),						valueNode.getTypeId().getSQLTypeName()						);			}		}	}	/** 	 * Determine whether or not any of the elements in the list are nullable.	 *	 * @return boolean	Whether or not any of the elements in the list 	 *					are nullable.	 */	public boolean isNullable()	{		int size = size();		for (int index = 0; index < size; index++)		{			if (((ValueNode) elementAt(index)).getTypeServices().isNullable())			{				return true;			}		}		return false;	}										 	/**	 * Does this list contain a ParameterNode?	 *	 * @return boolean	Whether or not the list contains a ParameterNode	 */	public boolean containsParameterNode()	{		int size = size();		for (int index = 0; index < size; index++)		{			if (((ValueNode) elementAt(index)).isParameterNode())			{				return true;			}		}		return false;	}										 	/**	 * Does this list contain all ParameterNodes?	 *	 * @return boolean	Whether or not the list contains all ParameterNodes	 */	public boolean containsAllParameterNodes()	{		int size = size();		for (int index = 0; index < size; index++)		{			if (! (((ValueNode) elementAt(index)).isParameterNode()))			{				return false;			}		}		return true;	}	/**	 * Does this list contain all ConstantNodes?	 *	 * @return boolean	Whether or not the list contains all ConstantNodes	 */	public boolean containsAllConstantNodes()	{		int size = size();		for (int index = 0; index < size; index++)		{			if (! ((ValueNode) elementAt(index) instanceof ConstantNode))			{				return false;			}		}		return true;	}	/**	 * Sort the entries in the list in ascending order.	 * (All values are assumed to be constants.)	 *	 * @param judgeODV  In case of type not exactly matching, the judging type.	 * @return Nothing.	 *	 * @exception StandardException		Thrown on error	 */	void sortInAscendingOrder(DataValueDescriptor judgeODV)		throws StandardException	{		int size = size();		if (SanityManager.DEBUG)		{			SanityManager.ASSERT(size > 0,				"size() expected to be non-zero");		}		/* We use bubble sort to sort the list since we expect		 * the list to be in sorted order > 90% of the time.		 */		boolean continueSort = true;		while (continueSort)		{			continueSort = false;						for (int index = 1; index < size; index++)			{				ConstantNode currCN = (ConstantNode) elementAt(index);				DataValueDescriptor currODV =					 currCN.getValue();				ConstantNode prevCN = (ConstantNode) elementAt(index - 1);				DataValueDescriptor prevODV =					 prevCN.getValue();				/* Swap curr and prev if prev > curr */				if ((judgeODV == null && (prevODV.compare(currODV)) > 0) ||					(judgeODV != null && judgeODV.greaterThan(prevODV, currODV).equals(true)))				{					setElementAt(currCN, index - 1);					setElementAt(prevCN, index);					continueSort = true;				}			}		}	}	/**	 * Set the descriptor for every ParameterNode in the list.	 *	 * @param descriptor	The DataTypeServices to set for the parameters	 *	 * @return	Nothing	 *	 * @exception StandardException		Thrown on error	 */	public void setParameterDescriptor(DataTypeDescriptor descriptor)						throws StandardException	{		int size = size();		ValueNode	valueNode;		for (int index = 0; index < size; index++)		{			valueNode = (ValueNode) elementAt(index);			if (valueNode.isParameterNode())			{				((ParameterNode) valueNode).setDescriptor(descriptor);			}		}	}	/**	 * Preprocess a ValueNodeList.  For now, we just preprocess each ValueNode	 * in the list.	 *	 * @param	numTables			Number of tables in the DML Statement	 * @param	outerFromList		FromList from outer query block	 * @param	outerSubqueryList	SubqueryList from outer query block	 * @param	outerPredicateList	PredicateList from outer query block	 *	 * @return	Nothing.	 *	 * @exception StandardException		Thrown on error	 */	public void preprocess(int numTables,							FromList outerFromList,							SubqueryList outerSubqueryList,							PredicateList outerPredicateList) 		throws StandardException	{		int size = size();		ValueNode	valueNode;		for (int index = 0; index < size; index++)		{			valueNode = (ValueNode) elementAt(index);			valueNode.preprocess(numTables,								 outerFromList, outerSubqueryList,								 outerPredicateList);		}	}	/**	 * Remap all ColumnReferences in this tree to be clones of the	 * underlying expression.	 *	 * @return ValueNodeList			The remapped expression tree.	 *	 * @exception StandardException			Thrown on error	 */	public ValueNodeList remapColumnReferencesToExpressions()		throws StandardException	{		int size = size();		for (int index = 0; index < size; index++)		{			setElementAt(				((ValueNode) elementAt(index)).remapColumnReferencesToExpressions(),				index);		}		return this;	}	/**	 * Return whether or not this expression tree represents a constant expression.	 *	 * @return	Whether or not this expression tree represents a constant expression.	 */	public boolean isConstantExpression()	{		int size = size();		for (int index = 0; index < size; index++)		{			boolean retcode;			retcode = ((ValueNode) elementAt(index)).isConstantExpression();			if (! retcode)			{				return retcode;			}		}		return true;	}	/** @see ValueNode#constantExpression */	public boolean constantExpression(PredicateList whereClause)	{		int size = size();		for (int index = 0; index < size; index++)		{			boolean retcode;			retcode =				((ValueNode) elementAt(index)).constantExpression(whereClause);			if (! retcode)			{				return retcode;			}		}		return true;	}	/**	 * Categorize this predicate.  Initially, this means	 * building a bit map of the referenced tables for each predicate.	 * If the source of this ColumnReference (at the next underlying level) 	 * is not a ColumnReference or a VirtualColumnNode then this predicate	 * will not be pushed down.	 *	 * For example, in:	 *		select * from (select 1 from s) a (x) where x = 1	 * we will not push down x = 1.	 * NOTE: It would be easy to handle the case of a constant, but if the	 * inner SELECT returns an arbitrary expression, then we would have to copy	 * that tree into the pushed predicate, and that tree could contain	 * subqueries and method calls.	 * RESOLVE - revisit this issue once we have views.	 *	 * @param referencedTabs	JBitSet with bit map of referenced FromTables	 * @param simplePredsOnly	Whether or not to consider method	 *							calls, field references and conditional nodes	 *							when building bit map	 *	 * @return boolean		Whether or not source.expression is a ColumnReference	 *						or a VirtualColumnNode.	 * @exception StandardException		Thrown on error	 */	public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)		throws StandardException	{		/* We stop here when only considering simple predicates		 *  as we don't consider in lists when looking		 * for null invariant predicates.		 */		boolean pushable = true;		int size = size();		for (int index = 0; index < size; index++)		{			pushable = ((ValueNode) elementAt(index)).categorize(referencedTabs, simplePredsOnly) &&					   pushable;		}		return pushable;	}	/**	 * Return the variant type for the underlying expression.	 * The variant type can be:	 *		VARIANT				- variant within a scan	 *							  (method calls and non-static field access)	 *		SCAN_INVARIANT		- invariant within a scan	 *							  (column references from outer tables)	 *		QUERY_INVARIANT		- invariant within the life of a query	 *		CONSTANT			- constant	 *	 * @return	The variant type for the underlying expression.	 * @exception StandardException	thrown on error	 */	protected int getOrderableVariantType() throws StandardException	{		int listType = Qualifier.CONSTANT;		int size = size();		/* If any element in the list is VARIANT then the 		 * entire expression is variant		 * else it is SCAN_INVARIANT if any element is SCAN_INVARIANT		 * else it is QUERY_INVARIANT.		 */		for (int index = 0; index < size; index++)		{			int curType = ((ValueNode) elementAt(index)).getOrderableVariantType();			listType = Math.min(listType, curType);		}		return listType;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -