Package ca.cgjennings.layout
Class BreakIteratorAdpater
- java.lang.Object
-
- java.text.BreakIterator
-
- ca.cgjennings.layout.BreakIteratorAdpater
-
- All Implemented Interfaces:
java.lang.Cloneable
public abstract class BreakIteratorAdpater extends java.text.BreakIterator
An abstract class that allows subclasses to easily create classes that filter out undesired break points returned by ajava.text.BreakIterator
instance.It works by wrapping an existing base
BreakIterator
that returns a superset of the desired break points. Before any potential break point is returned from the adaptor, the adapter will validate it by callingisBreakValidInternal(int)
. If that returnstrue
, then the break is returned to the caller. If it returnsfalse
, the break will be filtered out. The next valid break in the same direction will then be substituted until an acceptable break is found.- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description BreakIteratorAdpater()
BreakIteratorAdpater(java.text.BreakIterator wrapee)
BreakIteratorAdpater(java.util.Locale loc)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
current()
int
first()
int
following(int offset)
java.text.BreakIterator
getBreakIterator()
java.text.CharacterIterator
getText()
protected abstract boolean
isBreakValid(int pos)
int
last()
int
next()
int
next(int n)
int
previous()
void
setBreakIterator(java.text.BreakIterator wrapee)
void
setText(java.text.CharacterIterator newText)
-
-
-
Method Detail
-
isBreakValid
protected abstract boolean isBreakValid(int pos)
-
current
public int current()
- Specified by:
current
in classjava.text.BreakIterator
-
first
public int first()
- Specified by:
first
in classjava.text.BreakIterator
-
following
public int following(int offset)
- Specified by:
following
in classjava.text.BreakIterator
-
getText
public java.text.CharacterIterator getText()
- Specified by:
getText
in classjava.text.BreakIterator
-
setText
public void setText(java.text.CharacterIterator newText)
- Specified by:
setText
in classjava.text.BreakIterator
-
last
public int last()
- Specified by:
last
in classjava.text.BreakIterator
-
next
public int next()
- Specified by:
next
in classjava.text.BreakIterator
-
next
public int next(int n)
- Specified by:
next
in classjava.text.BreakIterator
-
previous
public int previous()
- Specified by:
previous
in classjava.text.BreakIterator
-
setBreakIterator
public void setBreakIterator(java.text.BreakIterator wrapee)
-
getBreakIterator
public java.text.BreakIterator getBreakIterator()
-
-