Exemplo n.º 1
0
        /**
         * Creates a clone of the {@link SelectItem} for use within a cloned
         * {@link Query}.
         *
         * @param clonedQuery
         *            a new {@link Query} object that represents the clone-to-be of
         *            a query. It is expected that {@link FromItem}s have already
         *            been cloned in this {@link Query}.
         * @return
         */
        public SelectItem clone(Query clonedQuery)
        {
            SelectItem subQuerySelectItem = (_subQuerySelectItem == null ? null : _subQuerySelectItem.clone());
            FromItem   fromItem;

            if (_fromItem == null)
            {
                fromItem = null;
            }
            else if (clonedQuery != null && _query != null)
            {
                int indexOfFromItem = _query.getFromClause().indexOf(_fromItem);
                if (indexOfFromItem != -1)
                {
                    fromItem = clonedQuery.getFromClause().getItem(indexOfFromItem);
                }
                else
                {
                    fromItem = _fromItem.clone();
                }
            }
            else
            {
                fromItem = _fromItem.clone();
            }

            SelectItem s = new SelectItem(_column, fromItem, _function, _functionParameters, _expression,
                                          subQuerySelectItem, _alias, _functionApproximationAllowed);

            return(s);
        } // clone()
Exemplo n.º 2
0
        // @Override
        public FilterItem clone()
        {
            NList <FilterItem> orItems;

            if (_childItems == null)
            {
                orItems = null;
            }
            else
            {
                orItems = _childItems;
            }

            object operand;

            if (_operand is SelectItem)
            {
                operand = ((SelectItem)_operand).clone();
            }
            else
            {
                operand = _operand;
            }

            SelectItem selectItem;

            if (_selectItem == null)
            {
                selectItem = null;
            }
            else
            {
                selectItem = _selectItem.clone();
            }

            return(new FilterItem(selectItem, _operator, operand, orItems, _expression, _logicalOperator));
        }