Top Description Constructors Methods
com.ibm.icu.text

public abstract Class FilteredBreakIteratorBuilder

extends Object
Class Inheritance
Known Direct Subclasses
com.ibm.icu.impl.SimpleFilteredSentenceBreakIterator.Builder
Imports
java.util.Locale, com.ibm.icu.impl.SimpleFilteredSentenceBreakIterator, com.ibm.icu.util.ULocale

The BreakIteratorFilter is used to modify the behavior of a BreakIterator by constructing a new BreakIterator which suppresses certain segment boundaries. See http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions . For example, a typical English Sentence Break Iterator would break on the space in the string "Mr. Smith" (resulting in two segments), but with "Mr." as an exception, a filtered break iterator would consider the string "Mr. Smith" to be a single segment.

This class is not intended for public subclassing.

ICU Status
Stable since ICU 60.

Constructor Summary

AccessConstructor and Description
protected
FilteredBreakIteratorBuilder()

Deprecated internal to ICU
For subclass use

Method Summary

Modifier and TypeMethod and Description
public static final FilteredBreakIteratorBuilder

Returns:

the new builder
getEmptyInstance
()

Construct an empty FilteredBreakIteratorBuilder.

public static final FilteredBreakIteratorBuilder

Returns:

the new builder
getInstance
(Locale
the locale.
where
)

Construct a FilteredBreakIteratorBuilder based on sentence break exception rules in a locale.

public static final FilteredBreakIteratorBuilder

Returns:

the new builder
getInstance
(ULocale
the locale.
where
)

Construct a FilteredBreakIteratorBuilder based on sentence break exception rules in a locale.

public abstract boolean

Returns:

true if the string was not present and now added, false if the call was a no-op because the string was already being suppressed.
suppressBreakAfter
(CharSequence
the string to suppress, such as "Mr."
str
)

Suppress a certain string from being the end of a segment.

public abstract boolean

Returns:

true if the string was present and now removed, false if the call was a no-op because the string was not being suppressed.
unsuppressBreakAfter
(CharSequence
the str the string to unsuppress, such as "Mr."
str
)

Stop suppressing a certain string from being the end of the segment.

public abstract BreakIterator

Returns:

the new BreakIterator
wrapIteratorWithFilter
(BreakIterator
the break iterator to wrap
wrappedBreakIterator
)

Wrap (adopt) an existing break iterator in a new filtered instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FilteredBreakIteratorBuilderback to summary
protected FilteredBreakIteratorBuilder()

Deprecated

internal to ICU

For subclass use

Annotations
@Deprecated
ICU Status
Internal ICU component.

Method Detail

getEmptyInstanceback to summary
public static final FilteredBreakIteratorBuilder getEmptyInstance()

Construct an empty FilteredBreakIteratorBuilder. In this state, it will not suppress any segment boundaries.

Returns:FilteredBreakIteratorBuilder

the new builder

ICU Status
Stable since ICU 60.
getInstanceback to summary
public static final FilteredBreakIteratorBuilder getInstance(Locale where)

Construct a FilteredBreakIteratorBuilder based on sentence break exception rules in a locale. The rules are taken from CLDR exception data for the locale, see http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions This is the equivalent of calling createInstance(UErrorCode&) and then repeatedly calling addNoBreakAfter(...) with the contents of the CLDR exception data.

Parameters
where:Locale

the locale.

Returns:FilteredBreakIteratorBuilder

the new builder

ICU Status
Stable since ICU 60.
getInstanceback to summary
public static final FilteredBreakIteratorBuilder getInstance(ULocale where)

Construct a FilteredBreakIteratorBuilder based on sentence break exception rules in a locale. The rules are taken from CLDR exception data for the locale, see http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions This is the equivalent of calling createInstance(UErrorCode&) and then repeatedly calling addNoBreakAfter(...) with the contents of the CLDR exception data.

Parameters
where:ULocale

the locale.

Returns:FilteredBreakIteratorBuilder

the new builder

ICU Status
Stable since ICU 60.
suppressBreakAfterback to summary
public abstract boolean suppressBreakAfter(CharSequence str)

Suppress a certain string from being the end of a segment. For example, suppressing "Mr.", then segments ending in "Mr." will not be returned by the iterator.

Parameters
str:CharSequence

the string to suppress, such as "Mr."

Returns:boolean

true if the string was not present and now added, false if the call was a no-op because the string was already being suppressed.

ICU Status
Stable since ICU 60.
unsuppressBreakAfterback to summary
public abstract boolean unsuppressBreakAfter(CharSequence str)

Stop suppressing a certain string from being the end of the segment. This function does not create any new segment boundaries, but only serves to un-do the effect of earlier calls to suppressBreakAfter, or to un-do the effect of locale data which may be suppressing certain strings.

Parameters
str:CharSequence

the str the string to unsuppress, such as "Mr."

Returns:boolean

true if the string was present and now removed, false if the call was a no-op because the string was not being suppressed.

ICU Status
Stable since ICU 60.
wrapIteratorWithFilterback to summary
public abstract BreakIterator wrapIteratorWithFilter(BreakIterator wrappedBreakIterator)

Wrap (adopt) an existing break iterator in a new filtered instance. Note that the wrappedBreakIterator is adopted by the new BreakIterator and should no longer be used by the caller. The FilteredBreakIteratorBuilder may be reused.

Parameters
wrappedBreakIterator:BreakIterator

the break iterator to wrap

Returns:BreakIterator

the new BreakIterator

ICU Status
Stable since ICU 60.