1 /* 2 * ModeShape (http://www.modeshape.org) 3 * See the COPYRIGHT.txt file distributed with this work for information 4 * regarding copyright ownership. Some portions may be licensed 5 * to Red Hat, Inc. under one or more contributor license agreements. 6 * See the AUTHORS.txt file in the distribution for a full listing of 7 * individual contributors. 8 * 9 * ModeShape is free software. Unless otherwise indicated, all code in ModeShape 10 * is licensed to you under the terms of the GNU Lesser General Public License as 11 * published by the Free Software Foundation; either version 2.1 of 12 * the License, or (at your option) any later version. 13 * 14 * ModeShape is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this software; if not, write to the Free 21 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 22 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 23 */ 24 package org.modeshape.graph.query.model; 25 26 import java.util.List; 27 28 /** 29 * Represents the abstract base class for all query commands. Subclasses include {@link Query} and {@link SetQuery}. 30 */ 31 public interface QueryCommand extends Command { 32 /** 33 * Return the orderings for this query. 34 * 35 * @return the list of orderings; never null 36 */ 37 public List<? extends Ordering> orderings(); 38 39 /** 40 * Get the limits associated with this query. 41 * 42 * @return the limits; never null but possibly {@link Limit#isUnlimited() unlimited} 43 */ 44 public Limit limits(); 45 46 /** 47 * Return the columns defining the query results. If there are no columns, then the columns are implementation determined. 48 * 49 * @return the list of columns; never null 50 */ 51 public List<? extends Column> columns(); 52 53 /** 54 * Create a copy of this query, but one that uses the supplied limit on the number of result rows. 55 * 56 * @param rowLimit the limit that should be used; must be a positive number 57 * @return the copy of the query that uses the supplied limit; never null 58 */ 59 public QueryCommand withLimit( int rowLimit ); 60 61 /** 62 * Create a copy of this query, but one that uses the supplied offset. 63 * 64 * @param offset the limit that should be used; may not be negative 65 * @return the copy of the query that uses the supplied offset; never null 66 */ 67 public QueryCommand withOffset( int offset ); 68 }