APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.util.locale.provider

public Class BreakIteratorProviderImpl

extends BreakIteratorProvider
implements AvailableLanguageTags
Class Inheritance
All Implemented Interfaces
sun.util.locale.provider.AvailableLanguageTags
Imports
java.text.BreakIterator, .CharacterIterator, java.text.spi.BreakIteratorProvider, java.util.ArrayList, .Collections, .List, .Locale, .MissingResourceException, .Objects, .Set, jdk.internal.util.regex.Grapheme, sun.text.DictionaryBasedBreakIterator, .RuleBasedBreakIterator

Concrete implementation of the BreakIteratorProvider class for the JRE LocaleProviderAdapter.
Authors
Naoto Sato, Masayoshi Okutsu

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
BreakIteratorProviderImpl.CharacterIteratorCharSequence

Implementation only for calling Grapheme.nextBoundary().

pack-priv static class

Field Summary

Modifier and TypeField and Description
private final Set<String>
private static final int
private static final int
private final LocaleProviderAdapter.Type
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Set<String>
getAvailableLanguageTags()

Implements sun.util.locale.provider.AvailableLanguageTags.getAvailableLanguageTags.

Returns a set of available language tags of a LocaleServiceProvider.

public Locale[]

Returns:

An array of all locales for which this locale service provider can provide localized objects or names.
getAvailableLocales
()

Implements abstract java.util.spi.LocaleServiceProvider.getAvailableLocales.

Returns an array of all locales for which this locale service provider can provide localized objects or names.

private BreakIterator
getBreakInstance(Locale locale, int type, String ruleName, String dictionaryName)

public BreakIterator

Returns:

A break iterator for character breaks
getCharacterInstance
(Locale
the desired locale
locale
)

Implements abstract java.text.spi.BreakIteratorProvider.getCharacterInstance.

Returns a new BreakIterator instance for character breaks for the given locale.

public BreakIterator

Returns:

A break iterator for line breaks
getLineInstance
(Locale
the desired locale
locale
)

Implements abstract java.text.spi.BreakIteratorProvider.getLineInstance.

Returns a new BreakIterator instance for line breaks for the given locale.

public BreakIterator

Returns:

A break iterator for sentence breaks
getSentenceInstance
(Locale
the desired locale
locale
)

Implements abstract java.text.spi.BreakIteratorProvider.getSentenceInstance.

Returns a new BreakIterator instance for sentence breaks for the given locale.

public BreakIterator

Returns:

A break iterator for word breaks
getWordInstance
(Locale
the desired locale
locale
)

Implements abstract java.text.spi.BreakIteratorProvider.getWordInstance.

Returns a new BreakIterator instance for word breaks for the given locale.

public boolean
isSupportedLocale(Locale locale)

Overrides java.util.spi.LocaleServiceProvider.isSupportedLocale.

Returns true if the given locale is supported by this locale service provider.

Field Detail

langtagsback to summary
private final Set<String> langtags
LINE_INDEXback to summary
private static final int LINE_INDEX
SENTENCE_INDEXback to summary
private static final int SENTENCE_INDEX
typeback to summary
private final LocaleProviderAdapter.Type type
WORD_INDEXback to summary
private static final int WORD_INDEX

Constructor Detail

BreakIteratorProviderImplback to summary
public BreakIteratorProviderImpl(LocaleProviderAdapter.Type type, Set<String> langtags)

Method Detail

getAvailableLanguageTagsback to summary
public Set<String> getAvailableLanguageTags()

Implements sun.util.locale.provider.AvailableLanguageTags.getAvailableLanguageTags.

Doc from sun.util.locale.provider.AvailableLanguageTags.getAvailableLanguageTags.

Returns a set of available language tags of a LocaleServiceProvider. Note that the returned set doesn't contain the language tag for Locale.Root.

Annotations
@Override
getAvailableLocalesback to summary
public Locale[] getAvailableLocales()

Implements abstract java.util.spi.LocaleServiceProvider.getAvailableLocales.

Returns an array of all locales for which this locale service provider can provide localized objects or names.

Returns:Locale[]

An array of all locales for which this locale service provider can provide localized objects or names.

Annotations
@Override
getBreakInstanceback to summary
private BreakIterator getBreakInstance(Locale locale, int type, String ruleName, String dictionaryName)
getCharacterInstanceback to summary
public BreakIterator getCharacterInstance(Locale locale)

Implements abstract java.text.spi.BreakIteratorProvider.getCharacterInstance.

Returns a new BreakIterator instance for character breaks for the given locale.

Parameters
locale:Locale

the desired locale

Returns:BreakIterator

A break iterator for character breaks

Annotations
@Override
Exceptions
NullPointerException:
if locale is null
IllegalArgumentException:
if locale isn't one of the locales returned from getAvailableLocales().
See Also
java.text.BreakIterator#getCharacterInstance(java.util.Locale)
getLineInstanceback to summary
public BreakIterator getLineInstance(Locale locale)

Implements abstract java.text.spi.BreakIteratorProvider.getLineInstance.

Returns a new BreakIterator instance for line breaks for the given locale.

Parameters
locale:Locale

the desired locale

Returns:BreakIterator

A break iterator for line breaks

Annotations
@Override
Exceptions
NullPointerException:
if locale is null
IllegalArgumentException:
if locale isn't one of the locales returned from getAvailableLocales().
See Also
java.text.BreakIterator#getLineInstance(java.util.Locale)
getSentenceInstanceback to summary
public BreakIterator getSentenceInstance(Locale locale)

Implements abstract java.text.spi.BreakIteratorProvider.getSentenceInstance.

Returns a new BreakIterator instance for sentence breaks for the given locale.

Parameters
locale:Locale

the desired locale

Returns:BreakIterator

A break iterator for sentence breaks

Annotations
@Override
Exceptions
NullPointerException:
if locale is null
IllegalArgumentException:
if locale isn't one of the locales returned from getAvailableLocales().
See Also
java.text.BreakIterator#getSentenceInstance(java.util.Locale)
getWordInstanceback to summary
public BreakIterator getWordInstance(Locale locale)

Implements abstract java.text.spi.BreakIteratorProvider.getWordInstance.

Returns a new BreakIterator instance for word breaks for the given locale.

Parameters
locale:Locale

the desired locale

Returns:BreakIterator

A break iterator for word breaks

Annotations
@Override
Exceptions
NullPointerException:
if locale is null
IllegalArgumentException:
if locale isn't one of the locales returned from getAvailableLocales().
See Also
java.text.BreakIterator#getWordInstance(java.util.Locale)
isSupportedLocaleback to summary
public boolean isSupportedLocale(Locale locale)

Overrides java.util.spi.LocaleServiceProvider.isSupportedLocale.

Doc from java.util.spi.LocaleServiceProvider.isSupportedLocale.

Returns true if the given locale is supported by this locale service provider. The given locale may contain extensions that should be taken into account for the support determination.

The default implementation returns true if the given locale is equal to any of the available Locales returned by getAvailableLocales() with ignoring any extensions in both the given locale and the available locales. Concrete locale service provider implementations should override this method if those implementations are Locale extensions-aware. For example, DecimalFormatSymbolsProvider implementations will need to check extensions in the given locale to see if any numbering system is specified and can be supported. However, CollatorProvider implementations may not be affected by any particular numbering systems, and in that case, extensions for numbering systems should be ignored.

Annotations
@Override
sun.util.locale.provider back to summary

pack-priv final Class BreakIteratorProviderImpl.CharacterIteratorCharSequence

extends Object
implements CharSequence
Class Inheritance
  • java.lang.Object
  • sun.util.locale.provider.BreakIteratorProviderImpl.CharacterIteratorCharSequence
All Implemented Interfaces
java.lang.CharSequence

Implementation only for calling Grapheme.nextBoundary(). This is a special-purpose CharSequence that represents characters in the index range [0..endIndex) of the underlying CharacterIterator, even if that CharacterIterator represents the subrange of some string. The calling code in GraphemeBreakIterator takes care to ensure that only valid indexes into the src are used.

Field Summary

Modifier and TypeField and Description
pack-priv CharacterIterator

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public char
charAt(int index)

Implements java.lang.CharSequence.charAt.

Returns the char value at the specified index.

public int
length()

Implements java.lang.CharSequence.length.

Returns the length of this character sequence.

public CharSequence
subSequence(int start, int end)

Implements java.lang.CharSequence.subSequence.

Returns a CharSequence that is a subsequence of this sequence.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

srcback to summary
pack-priv CharacterIterator src

Constructor Detail

CharacterIteratorCharSequenceback to summary
pack-priv CharacterIteratorCharSequence(CharacterIterator ci)

Method Detail

charAtback to summary
public char charAt(int index)

Implements java.lang.CharSequence.charAt.

Doc from java.lang.CharSequence.charAt.

Returns the char value at the specified index. An index ranges from zero to length() - 1. The first char value of the sequence is at index zero, the next at index one, and so on, as for array indexing.

If the char value specified by the index is a surrogate, the surrogate value is returned.

Annotations
@Override
lengthback to summary
public int length()

Implements java.lang.CharSequence.length.

Doc from java.lang.CharSequence.length.

Returns the length of this character sequence. The length is the number of 16-bit chars in the sequence.

Annotations
@Override
subSequenceback to summary
public CharSequence subSequence(int start, int end)

Implements java.lang.CharSequence.subSequence.

Doc from java.lang.CharSequence.subSequence.

Returns a CharSequence that is a subsequence of this sequence. The subsequence starts with the char value at the specified index and ends with the char value at index end - 1. The length (in chars) of the returned sequence is end - start, so if start == end then an empty sequence is returned.

Annotations
@Override
sun.util.locale.provider back to summary

pack-priv final Class BreakIteratorProviderImpl.GraphemeBreakIterator

extends BreakIterator
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv List<Integer>
pack-priv int
pack-priv CharacterIterator
pack-priv int
Inherited from java.text.BreakIterator:
DONE

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
current()

Implements abstract java.text.BreakIterator.current.

Returns character index of the text boundary that was most recently returned by next(), next(int), previous(), first(), last(), following(int) or preceding(int).

public boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
first()

Implements abstract java.text.BreakIterator.first.

Returns the first boundary.

public int
following(int offset)

Implements abstract java.text.BreakIterator.following.

Returns the first boundary following the specified character offset.

public CharacterIterator
getText()

Implements abstract java.text.BreakIterator.getText.

Get the text being scanned

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
isBoundary(int offset)

Overrides java.text.BreakIterator.isBoundary.

Returns true if the specified character offset is a text boundary.

public int
last()

Implements abstract java.text.BreakIterator.last.

Returns the last boundary.

public int
next(int n)

Implements abstract java.text.BreakIterator.next.

Returns the nth boundary from the current boundary.

public int
next()

Implements abstract java.text.BreakIterator.next.

Returns the boundary following the current boundary.

public int
previous()

Implements abstract java.text.BreakIterator.previous.

Returns the boundary preceding the current boundary.

public void
setText(CharacterIterator newText)

Implements abstract java.text.BreakIterator.setText.

Set a new text for scanning.

Inherited from java.text.BreakIterator:
clonegetAvailableLocalesgetCharacterInstancegetCharacterInstancegetLineInstancegetLineInstancegetSentenceInstancegetSentenceInstancegetWordInstancegetWordInstanceprecedingsetText

Field Detail

boundariesback to summary
pack-priv List<Integer> boundaries
boundaryIndexback to summary
pack-priv int boundaryIndex
ciback to summary
pack-priv CharacterIterator ci
offsetback to summary
pack-priv int offset

Constructor Detail

GraphemeBreakIteratorback to summary
pack-priv GraphemeBreakIterator()

Method Detail

currentback to summary
public int current()

Implements abstract java.text.BreakIterator.current.

Doc from java.text.BreakIterator.current.

Returns character index of the text boundary that was most recently returned by next(), next(int), previous(), first(), last(), following(int) or preceding(int). If any of these methods returns BreakIterator.DONE because either first or last text boundary has been reached, it returns the first or last text boundary depending on which one is reached.

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
firstback to summary
public int first()

Implements abstract java.text.BreakIterator.first.

Doc from java.text.BreakIterator.first.

Returns the first boundary. The iterator's current position is set to the first text boundary.

Annotations
@Override
followingback to summary
public int following(int offset)

Implements abstract java.text.BreakIterator.following.

Doc from java.text.BreakIterator.following.

Returns the first boundary following the specified character offset. If the specified offset is equal to the last text boundary, it returns BreakIterator.DONE and the iterator's current position is unchanged. Otherwise, the iterator's current position is set to the returned boundary. The value returned is always greater than the offset or the value BreakIterator.DONE.

Annotations
@Override
getTextback to summary
public CharacterIterator getText()

Implements abstract java.text.BreakIterator.getText.

Doc from java.text.BreakIterator.getText.

Get the text being scanned

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
isBoundaryback to summary
public boolean isBoundary(int offset)

Overrides java.text.BreakIterator.isBoundary.

Doc from java.text.BreakIterator.isBoundary.

Returns true if the specified character offset is a text boundary.

Annotations
@Override
lastback to summary
public int last()

Implements abstract java.text.BreakIterator.last.

Doc from java.text.BreakIterator.last.

Returns the last boundary. The iterator's current position is set to the last text boundary.

Annotations
@Override
nextback to summary
public int next(int n)

Implements abstract java.text.BreakIterator.next.

Doc from java.text.BreakIterator.next.

Returns the nth boundary from the current boundary. If either the first or last text boundary has been reached, it returns BreakIterator.DONE and the current position is set to either the first or last text boundary depending on which one is reached. Otherwise, the iterator's current position is set to the new boundary. For example, if the iterator's current position is the mth text boundary and three more boundaries exist from the current boundary to the last text boundary, the next(2) call will return m + 2. The new text position is set to the (m + 2)th text boundary. A next(4) call would return BreakIterator.DONE and the last text boundary would become the new text position.

Annotations
@Override
nextback to summary
public int next()

Implements abstract java.text.BreakIterator.next.

Doc from java.text.BreakIterator.next.

Returns the boundary following the current boundary. If the current boundary is the last text boundary, it returns BreakIterator.DONE and the iterator's current position is unchanged. Otherwise, the iterator's current position is set to the boundary following the current boundary.

Annotations
@Override
previousback to summary
public int previous()

Implements abstract java.text.BreakIterator.previous.

Doc from java.text.BreakIterator.previous.

Returns the boundary preceding the current boundary. If the current boundary is the first text boundary, it returns BreakIterator.DONE and the iterator's current position is unchanged. Otherwise, the iterator's current position is set to the boundary preceding the current boundary.

Annotations
@Override
setTextback to summary
public void setText(CharacterIterator newText)

Implements abstract java.text.BreakIterator.setText.

Doc from java.text.BreakIterator.setText.

Set a new text for scanning. The current scan position is reset to first().

Annotations
@Override