Source code: com/eireneh/bible/control/search/words/RemoveCommandWord.java
1
2 package com.eireneh.bible.control.search.words;
3
4 import java.util.Enumeration;
5
6 import com.eireneh.bible.passage.*;
7 import com.eireneh.bible.control.search.*;
8
9 /**
10 * Alter the Passage by calling removeAll with a
11 * Passage grabbed from the next word in the search string.
12 *
13 * <table border='1' cellPadding='3' cellSpacing='0' width="100%">
14 * <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
15 * Distribution Licence:<br />
16 * Project B is free software; you can redistribute it
17 * and/or modify it under the terms of the GNU General Public License,
18 * version 2 as published by the Free Software Foundation.<br />
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.<br />
23 * The License is available on the internet
24 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
25 * <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
26 * MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
27 * The copyright to this program is held by it's authors.
28 * </font></td></tr></table>
29 * @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
30 * @see docs.Licence
31 * @author Joe Walker
32 */
33 public class RemoveCommandWord implements CommandWord
34 {
35 /**
36 * Alter the Passage by calling removeAll with a
37 * Passage grabbed from the next word in the search string
38 * @param engine The controller that can provide access to the search
39 * string or a default Bible.
40 * @param ref The Passage to alter (if necessary)
41 */
42 public void updatePassage(Engine engine, Passage ref) throws SearchException
43 {
44 if (!engine.elements().hasMoreElements())
45 throw new SearchException("search_remove_blank");
46
47 ParamWord param = (ParamWord) engine.elements().nextElement();
48 ref.removeAll(param.getPassage(engine));
49 }
50 }