001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.type;
020
021import java.util.Iterator;
022import java.util.List;
023
024import lucee.runtime.exp.DatabaseException;
025import lucee.runtime.exp.DeprecatedException;
026
027/**
028 * implementation of the query column
029 */
030public final class DebugQueryColumn extends QueryColumnImpl implements QueryColumnPro,Sizeable,Objects {
031      
032        
033        private boolean used;
034
035
036        /**
037         * @return the used
038         */
039        public boolean isUsed() {
040                return used;
041        }
042        
043
044    public DebugQueryColumn(Object[] data, Key key, QueryImpl query,int size, int type,
045                        boolean typeChecked) {
046                this.data=data;
047                this.key=key;
048                this.query=query;
049                this.size=size;
050                this.type=type;
051                this.typeChecked=typeChecked;
052        }
053        
054        
055        /**
056         * Constructor of the class
057         * for internal usage only
058         */
059        public DebugQueryColumn() {
060                super();
061        }
062
063
064        @Override
065    public Object get(int row) throws DeprecatedException{
066        used=true;
067        return super.get(row);
068    }
069
070    /**
071     * touch the given line on the column at given row
072     * @param row
073     * @return new row or existing
074     * @throws DatabaseException
075     */
076    public Object touch(int row) {
077        used=true;
078        return super.touch(row);
079    }
080    
081    /**
082     * touch the given line on the column at given row
083     * @param row
084     * @return new row or existing
085     * @throws DatabaseException
086     */
087    public Object touchEL(int row) {
088        used=true;
089        return super.touchEL(row);
090    }
091
092        @Override
093        public Object get(int row, Object defaultValue) {
094                used=true;
095        return super.get(row,defaultValue);
096        }
097        
098    
099        public synchronized QueryColumnPro cloneColumn(QueryImpl query, boolean deepCopy) {
100        DebugQueryColumn clone=new DebugQueryColumn();
101        populate(this, clone, deepCopy);
102        return clone;
103    }
104
105        @Override
106        public Iterator<Object> valueIterator() {
107                used=true;
108                return super.valueIterator();
109        }
110        @Override
111        public int indexOf(Object o) {
112                used=true;
113                return super.indexOf(o);
114        }
115
116        @Override
117        public int lastIndexOf(Object o) {
118                used=true;
119                return super.lastIndexOf(o);
120        }
121
122        @Override
123        public List<Object> subList(int fromIndex, int toIndex) {
124                used=true;
125                return super.subList(fromIndex, toIndex);
126        }
127
128        @Override
129        public Object[] toArray() {
130                used=true;
131                return super.toArray();
132        }
133
134        @Override
135        public  Object[] toArray(Object[] trg) {
136                used=true;
137                return super.toArray(trg);
138        }
139        
140        public QueryColumnPro toDebugColumn() {
141                return this;
142        }
143}