java.text
Class MergeCollation

java.lang.Object
  extended byjava.text.MergeCollation

final class MergeCollation
extends Object

Utility class for normalizing and merging patterns for collation. Patterns are strings of the form *, where has the form: := * := {"/"} := "=", ",", ";", "<", "&" , and are both arbitrary strings. unquoted whitespaces are ignored. 'xxx' can be used to quote characters One difference from Collator is that & is used to reset to a current point. Or, in other words, it introduces a new sequence which is to be added to the old. That is: "a < b < c < d" is the same as "a < b & b < c & c < d" OR "a < b < d & b < c" XXX: make '' be a single quote.

Author:
Mark Davis, Helena Shih
See Also:
PatternEntry

Field Summary
private  byte BITARRAYMASK
           
private  int BYTEMASK
           
private  int BYTEPOWER
           
private  StringBuffer excess
           
private  PatternEntry lastEntry
           
(package private)  ArrayList patterns
           
private  PatternEntry saveEntry
           
private  byte[] statusArray
           
 
Constructor Summary
MergeCollation(String pattern)
          Creates from a pattern
 
Method Summary
 void addPattern(String pattern)
          adds a pattern to the current one.
 String emitPattern()
          emits the pattern for collation builder.
 String emitPattern(boolean withWhiteSpace)
          emits the pattern for collation builder.
private  int findLastEntry(PatternEntry entry, StringBuffer excessChars)
           
private  PatternEntry findLastWithNoExtension(int i)
           
private  void fixEntry(PatternEntry newEntry)
           
 int getCount()
          gets count of separate entries
 PatternEntry getItemAt(int index)
          gets count of separate entries
 String getPattern()
          recovers current pattern
 String getPattern(boolean withWhiteSpace)
          recovers current pattern.
 void setPattern(String pattern)
          sets the pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

patterns

ArrayList patterns

saveEntry

private transient PatternEntry saveEntry

lastEntry

private transient PatternEntry lastEntry

excess

private transient StringBuffer excess

statusArray

private transient byte[] statusArray

BITARRAYMASK

private final byte BITARRAYMASK
See Also:
Constant Field Values

BYTEPOWER

private final int BYTEPOWER
See Also:
Constant Field Values

BYTEMASK

private final int BYTEMASK
See Also:
Constant Field Values
Constructor Detail

MergeCollation

public MergeCollation(String pattern)
               throws ParseException
Creates from a pattern

Throws:
ParseException - If the input pattern is incorrect.
Method Detail

getPattern

public String getPattern()
recovers current pattern


getPattern

public String getPattern(boolean withWhiteSpace)
recovers current pattern.

Parameters:
withWhiteSpace - puts spacing around the entries, and \n before & and <

findLastWithNoExtension

private final PatternEntry findLastWithNoExtension(int i)

emitPattern

public String emitPattern()
emits the pattern for collation builder.

Returns:
emits the string in the format understable to the collation builder.

emitPattern

public String emitPattern(boolean withWhiteSpace)
emits the pattern for collation builder.

Parameters:
withWhiteSpace - puts spacing around the entries, and \n before & and <
Returns:
emits the string in the format understable to the collation builder.

setPattern

public void setPattern(String pattern)
                throws ParseException
sets the pattern.

Throws:
ParseException

addPattern

public void addPattern(String pattern)
                throws ParseException
adds a pattern to the current one.

Parameters:
pattern - the new pattern to be added
Throws:
ParseException

getCount

public int getCount()
gets count of separate entries

Returns:
the size of pattern entries

getItemAt

public PatternEntry getItemAt(int index)
gets count of separate entries

Parameters:
index - the offset of the desired pattern entry
Returns:
the requested pattern entry

fixEntry

private final void fixEntry(PatternEntry newEntry)
                     throws ParseException
Throws:
ParseException

findLastEntry

private final int findLastEntry(PatternEntry entry,
                                StringBuffer excessChars)
                         throws ParseException
Throws:
ParseException