com.ibm.icu.text
Enum UnicodeSet.SpanCondition

java.lang.Object
  extended by java.lang.Enum<UnicodeSet.SpanCondition>
      extended by com.ibm.icu.text.UnicodeSet.SpanCondition
All Implemented Interfaces:
Serializable, Comparable<UnicodeSet.SpanCondition>
Enclosing class:
UnicodeSet

public static enum UnicodeSet.SpanCondition
extends Enum<UnicodeSet.SpanCondition>

Argument values for whether span() and similar functions continue while the current character is contained vs. not contained in the set.

The functionality is straightforward for sets with only single code points, without strings (which is the common case):

When a set contains multi-code point strings, then these statements may not be true, depending on the strings in the set (for example, whether they overlap with each other) and the string that is processed. For a set with strings: Note: If it is important to get the same boundaries whether iterating forward or backward through a string, then either only span() should be used and the boundaries cached for backward operation, or an ICU BreakIterator could be used.

Note: Unpaired surrogates are treated like surrogate code points. Similarly, set strings match only on code point boundaries, never in the middle of a surrogate pair.

Status:
Stable ICU 4.4.

Enum Constant Summary
CONDITION_COUNT
          One more than the last span condition.
CONTAINED
          Continue a span() while there is a set element at the current position.
NOT_CONTAINED
          Continue a span() while there is no set element at the current position.
SIMPLE
          Continue a span() while there is a set element at the current position.
 
Method Summary
static UnicodeSet.SpanCondition valueOf(String name)
          Returns the enum constant of this type with the specified name.
static UnicodeSet.SpanCondition[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NOT_CONTAINED

public static final UnicodeSet.SpanCondition NOT_CONTAINED
Continue a span() while there is no set element at the current position. Stops before the first set element (character or string). (For code points only, this is like while contains(current)==FALSE).

When span() returns, the substring between where it started and the position it returned consists only of characters that are not in the set, and none of its strings overlap with the span.

Status:
Stable ICU 4.4.

CONTAINED

public static final UnicodeSet.SpanCondition CONTAINED
Continue a span() while there is a set element at the current position. (For characters only, this is like while contains(current)==TRUE).

When span() returns, the substring between where it started and the position it returned consists only of set elements (characters or strings) that are in the set.

If a set contains strings, then the span will be the longest substring matching any of the possible concatenations of set elements (characters or strings). (There must be a single, non-overlapping concatenation of characters or strings.) This is equivalent to a POSIX regular expression for (OR of each set element)*.

Status:
Stable ICU 4.4.

SIMPLE

public static final UnicodeSet.SpanCondition SIMPLE
Continue a span() while there is a set element at the current position. (For characters only, this is like while contains(current)==TRUE).

When span() returns, the substring between where it started and the position it returned consists only of set elements (characters or strings) that are in the set.

If a set only contains single characters, then this is the same as CONTAINED.

If a set contains strings, then the span will be the longest substring with a match at each position with the longest single set element (character or string).

Use this span condition together with other longest-match algorithms, such as ICU converters (ucnv_getUnicodeSet()).

Status:
Stable ICU 4.4.

CONDITION_COUNT

public static final UnicodeSet.SpanCondition CONDITION_COUNT
One more than the last span condition.

Status:
Stable ICU 4.4.
Method Detail

values

public static UnicodeSet.SpanCondition[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (UnicodeSet.SpanCondition c : UnicodeSet.SpanCondition.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static UnicodeSet.SpanCondition valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Copyright (c) 2010 IBM Corporation and others.