com.octo.captcha.component.word.wordgenerator
Class DictionaryWordGenerator

java.lang.Object
  extended by com.octo.captcha.component.word.wordgenerator.DictionaryWordGenerator
All Implemented Interfaces:
WordGenerator
Direct Known Subclasses:
ComposeDictionaryWordGenerator

public class DictionaryWordGenerator
extends java.lang.Object
implements WordGenerator

WordGenerator based on a dictionary. Uses a Dictionary reader to retrieve words and an WordList to store the words retrieved. Be sure your dictionary contains words whose length covers the whole range specified in your factory, some rutime exception will occur!


Constructor Summary
DictionaryWordGenerator(DictionaryReader reader)
           
 
Method Summary
 java.lang.String getWord(java.lang.Integer length)
          Return a word of length between min and max length
 java.lang.String getWord(java.lang.Integer length, java.util.Locale locale)
          Return a word of length between min and max length according to the given locale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DictionaryWordGenerator

public DictionaryWordGenerator(DictionaryReader reader)
Method Detail

getWord

public final java.lang.String getWord(java.lang.Integer length)
Return a word of length between min and max length

Specified by:
getWord in interface WordGenerator
Returns:
a String of length between min and max length

getWord

public java.lang.String getWord(java.lang.Integer length,
                                java.util.Locale locale)
Return a word of length between min and max length according to the given locale

Specified by:
getWord in interface WordGenerator
Parameters:
length - the word length
Returns:
a String of length between min and max length according to the given locale


Copyright 2003-2009 JCaptcha. All Rights Reserved.