📄 querymanager.java
字号:
/* * File: QueryManager.java * Project: MPI Linguistic Application * Date: 02 May 2007 * * Copyright (C) 2001-2007 Max Planck Institute for Psycholinguistics * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package mpi.search.query.model;import java.util.ArrayList;import java.util.List;/** * $Id: QueryManager.java,v 1.2 2007/03/09 10:12:33 klasal Exp $ * * @author Alexander Klassmann * $Version$ */public class QueryManager { /** Holds value of property DOCUMENT ME! */ private final List queries = new ArrayList(); private int currentQueryNr = 0; /** * get current query * * @return current query */ public Query getCurrentQuery() { return getQuery(currentQueryNr); } /** * sets current query to query with specified number has no effect, if the * number isn't in the range * * @param i wanted query number; */ public void setCurrentQueryNumber(int i) { if ((0 < i) && (i <= queries.size())) { currentQueryNr = i; } } /** * get number of current query * * @return current query number */ public int getCurrentQueryNumber() { return currentQueryNr; } /** * get query with specified number * * @param nr query number (starts with 1!) * * @return query */ public Query getQuery(int nr) { return (Query) (((0 < nr) && (nr <= queries.size())) ? queries.get(nr - 1) : null); } /** * add query * * @param query */ public void addQuery(Query query) { queries.add(query); currentQueryNr = queries.size(); } /** * checks if current query is last one * * @return true if current query is not last one */ public boolean hasNextQuery() { return currentQueryNr < queries.size(); } /** * checks if current query is first one * * @return true if current query is not first one */ public boolean hasPreviousQuery() { return currentQueryNr > 1; } /** * checks if there is any query * * @return if there is at least one query */ public boolean hasQuery() { return queries.size() > 0; } /** * count of queries * * @return number of queries */ public int size() { return queries.size(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -