View Javadoc

1   /*
2    * JCaptcha, the open source java framework for captcha definition and integration
3    * Copyright (c)  2007 jcaptcha.net. All Rights Reserved.
4    * See the LICENSE.txt file distributed with this package.
5    */
6   
7   /*
8    * jcaptcha, the open source java framework for captcha definition and integration
9    * copyright (c)  2007 jcaptcha.net. All Rights Reserved.
10   * See the LICENSE.txt file distributed with this package.
11   */
12  
13  /*
14   * jcaptcha, the open source java framework for captcha definition and integration
15   * copyright (c)  2007 jcaptcha.net. All Rights Reserved.
16   * See the LICENSE.txt file distributed with this package.
17   */
18  
19  package com.octo.captcha.component.word;
20  
21  import java.util.Locale;
22  
23  public class ArrayDictionary implements DictionaryReader {
24  
25      private DefaultSizeSortedWordList words;
26  
27      public ArrayDictionary(String[] words) {
28          this.words = new DefaultSizeSortedWordList(Locale.US);
29          for (int i = 0; i < words.length; i++) {
30  
31              String word = words[i];
32              this.words.addWord(word);
33          }
34      }
35  
36  
37      public SizeSortedWordList getWordList() {
38          return words;
39      }
40  
41      public SizeSortedWordList getWordList(Locale locale) {
42          return words;
43      }
44  }