1 /*****************************************************/
\r
2 /* This java file is a part of the */
\r
4 /* - Plouf's Java IRC Client - */
\r
6 /* Copyright (C) 2002 - 2004 Philippe Detournay */
\r
8 /* All contacts : theplouf@yahoo.com */
\r
10 /* PJIRC is free software; you can redistribute */
\r
11 /* it and/or modify it under the terms of the GNU */
\r
12 /* General Public License as published by the */
\r
13 /* Free Software Foundation; version 2 or later of */
\r
16 /* PJIRC is distributed in the hope that it will */
\r
17 /* be useful, but WITHOUT ANY WARRANTY; without */
\r
18 /* even the implied warranty of MERCHANTABILITY or */
\r
19 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
\r
20 /* General Public License for more details. */
\r
22 /* You should have received a copy of the GNU */
\r
23 /* General Public License along with PJIRC; if */
\r
24 /* not, write to the Free Software Foundation, */
\r
25 /* Inc., 59 Temple Place, Suite 330, Boston, */
\r
26 /* MA 02111-1307 USA */
\r
28 /*****************************************************/
\r
33 * Recognizer for list of words.
\r
35 public class WordListRecognizer implements WordRecognizer {
\r
36 private String[] _list;
\r
39 * Create a new WordListRecognizer.
\r
41 public WordListRecognizer() {
\r
42 setList(new String[0]);
\r
46 * Set the list of words to recognize.
\r
49 * the list of words.
\r
51 public void setList(String[] list) {
\r
52 _list = new String[list.length];
\r
53 for (int i = 0; i < list.length; i++)
\r
54 _list[i] = list[i].toLowerCase(java.util.Locale.ENGLISH);
\r
58 public boolean recognize(String word) {
\r
59 String lcase = word.toLowerCase(java.util.Locale.ENGLISH);
\r
60 for (int i = 0; i < _list.length; i++)
\r
61 if (lcase.equals(_list[i]))
\r
67 public String getType() {
\r