Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.javatools.editor.language
Class NaturalWordLocator

java.lang.Object
  extended by oracle.javatools.editor.language.NaturalWordLocator
All Implemented Interfaces:
WordLocator

public final class NaturalWordLocator
extends java.lang.Object
implements WordLocator

The NaturalWordLocator implementation that locates word boundaries on the JDK's BreakIterator for natural language boundaries.

See Also:
WordLocator

Constructor Summary
NaturalWordLocator(LanguageSupport support)
          Constructs a new NaturalWordLocator.
 
Method Summary
 int getNextWordEnd(int offset)
          Fetches the next offset where a word ends.
 int getNextWordStart(int offset)
          Fetches the next offset where a word starts from.
 int getPreviousWordEnd(int offset)
          Fetches the previous offset where a word ends.
 int getPreviousWordStart(int offset)
          Fetches the previous offset where a word starts from.
 int getWordEnd(int offset)
          Fetches the end of the word for the given offset location.
 int getWordStart(int offset)
          Fetches the start of the word for the given offset location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NaturalWordLocator

public NaturalWordLocator(LanguageSupport support)
Constructs a new NaturalWordLocator.

Parameters:
support - the language support and document this locator is used for
Method Detail

getWordStart

public int getWordStart(int offset)
Fetches the start of the word for the given offset location. If the offset occurs at the boundary between two words, then we will bias to the right, following the Swing defaults - this means that the offset is already at the start of the word on the right, and should return the same offset.

Specified by:
getWordStart in interface WordLocator
Parameters:
offset - the specified document offset
Returns:
the start of the word that the offset is contained in

getWordEnd

public int getWordEnd(int offset)
Fetches the end of the word for the given offset location. If the offset occurs at the boundary between two words, again, we will bias to the right, following the Swing defaults. This means that the offset is at the start of the word on the right, and should return that word's end offset.

Specified by:
getWordEnd in interface WordLocator
Parameters:
offset - the specified document offset
Returns:
the end of the word that the offset is contained in

getNextWordStart

public int getNextWordStart(int offset)
Fetches the next offset where a word starts from.

Specified by:
getNextWordStart in interface WordLocator
Parameters:
offset - the specified document offset
Returns:
the next start of a word

getNextWordEnd

public int getNextWordEnd(int offset)
Fetches the next offset where a word ends.

Specified by:
getNextWordEnd in interface WordLocator
Parameters:
offset - the specified document offset
Returns:
the next end of a word

getPreviousWordStart

public int getPreviousWordStart(int offset)
Fetches the previous offset where a word starts from.

Specified by:
getPreviousWordStart in interface WordLocator
Parameters:
offset - the specified document offset
Returns:
the previous start of a word

getPreviousWordEnd

public int getPreviousWordEnd(int offset)
Fetches the previous offset where a word ends.

Specified by:
getPreviousWordEnd in interface WordLocator
Parameters:
offset - the specified document offset
Returns:
the previous end of a word

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.