~sword-devel/jsword/trunk

« back to all changes in this revision

Viewing changes to jsword/java/jsword/org/crosswire/jsword/control/search/PassageLeftParamWord.java

  • Committer: joe
  • Date: 2002-10-08 21:36:18 UTC
  • Revision ID: svn-v4:a88caf3b-7e0a-0410-8d0d-cecb45342206:trunk:80
big config and comment update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
package org.crosswire.jsword.control.search;
3
3
 
4
 
import java.util.Enumeration;
 
4
import java.util.Iterator;
5
5
 
6
6
import org.crosswire.jsword.passage.NoSuchVerseException;
7
7
import org.crosswire.jsword.passage.Passage;
8
8
import org.crosswire.jsword.passage.PassageFactory;
9
9
 
10
10
/**
11
 
* The Search Word for a Word to search for. The default
12
 
* if no other SearchWords match.
13
 
*
14
 
* <table border='1' cellPadding='3' cellSpacing='0' width="100%">
15
 
* <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
16
 
* Distribution Licence:<br />
17
 
* Project B is free software; you can redistribute it
18
 
* and/or modify it under the terms of the GNU General Public License,
19
 
* version 2 as published by the Free Software Foundation.<br />
20
 
* This program is distributed in the hope that it will be useful,
21
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
 
* General Public License for more details.<br />
24
 
* The License is available on the internet
25
 
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
26
 
* <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27
 
* MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
28
 
* The copyright to this program is held by it's authors.
29
 
* </font></td></tr></table>
30
 
* @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
31
 
* @see <{docs.Licence}>
32
 
* @author Joe Walker
33
 
*/
 
11
 * The Search Word for a Word to search for. The default
 
12
 * if no other SearchWords match.
 
13
 * 
 
14
 * <p><table border='1' cellPadding='3' cellSpacing='0'>
 
15
 * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
 
16
 *
 
17
 * Distribution Licence:<br />
 
18
 * JSword is free software; you can redistribute it
 
19
 * and/or modify it under the terms of the GNU General Public License,
 
20
 * version 2 as published by the Free Software Foundation.<br />
 
21
 * This program is distributed in the hope that it will be useful,
 
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
24
 * General Public License for more details.<br />
 
25
 * The License is available on the internet
 
26
 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
 
27
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
28
 * MA 02111-1307, USA<br />
 
29
 * The copyright to this program is held by it's authors.
 
30
 * </font></td></tr></table>
 
31
 * @see docs.Licence
 
32
 * @author Joe Walker [joe at eireneh dot com]
 
33
 * @version $Id$
 
34
 */
34
35
public class PassageLeftParamWord implements ParamWord
35
36
{
36
37
    /**
54
55
    */
55
56
    public Passage getPassage(Engine engine) throws SearchException
56
57
    {
57
 
        Enumeration en = engine.elements();
 
58
        Iterator it = engine.iterator();
58
59
        StringBuffer buff = new StringBuffer();
59
60
 
60
61
        int paren_level = 1;
61
62
        while (true)
62
63
        {
63
 
            if (!engine.elements().hasMoreElements())
 
64
            if (!engine.iterator().hasNext())
64
65
                throw new SearchException("search_left_brackets");
65
66
 
66
 
            SearchWord word = (SearchWord) en.nextElement();
 
67
            SearchWord word = (SearchWord) it.next();
67
68
 
68
69
            if (word instanceof PassageLeftParamWord)   paren_level++;
69
70
            if (word instanceof PassageRightParamWord)  paren_level--;