alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Jazzy example source code file (WordFinder.java)

This example Jazzy source code file (WordFinder.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Jazzy tags/keywords

string, string, word, word, wordfinder, wordfinder

The Jazzy WordFinder.java source code

/*
Jazzy - a Java library for Spell Checking
Copyright (C) 2001 Mindaugas Idzelis
Full text of license can be found in LICENSE.txt

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/
package com.swabunga.spell.event;

/**
 * <p>An interface for objects which take a String as input, and iterates through
 * the words in the string.
 * </P>
 *
 * <P>
 * When the object is instantiated, and before the first call to <CODE>next() is made,
 * the following methods should throw a <CODE>WordNotFoundException:
* <CODE>current(), * <CODE>startsSentence() and replace(). * </P> * * <P>A call to next() when hasMoreWords() returns false * should throw a <CODE>WordNotFoundException.

* @author Jason Height (jheight@chariot.net.au) */ public interface WordFinder { //~ Methods ................................................................. /** * This method returns the text through which the WordFinder is iterating. * The text may have been modified through calls to replace(). * * @return the (possibly modified) text being searched. */ public String getText(); /** * This method resets the text through which the WordFinder iterates. * It must also re-initialize the WordFinder. * * @param newText the new text to search. */ public void setText(String newText); /** * This method should return the Word object representing the current word * in the iteration. * This method should not affect the state of the WordFinder object. * * @return the current Word object. * @throws WordNotFoundException current word has not yet been set. */ public Word current(); /** * Tests the finder to see if any more words are available. * * @return true if more words are available. */ public boolean hasNext(); /** * This method should return the Word object representing the next word * in the iteration (the first word if next() has not yet been called.) * * @return the next Word in the iteration. * @throws WordNotFoundException search string contains no more words. */ public Word next(); /** * This method should replace the current Word object with a Word object * representing the String newWord. * * @param newWord the word to replace the current word with. * @throws WordNotFoundException current word has not yet been set. */ public void replace(String newWord); /** * @return true if the current word starts a new sentence. * @throws WordNotFoundException current word has not yet been set. */ public boolean startsSentence(); // public void setText(); }

Other Jazzy examples (source code examples)

Here is a short list of links related to this Jazzy WordFinder.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.