Top Description Fields Constructors Methods
org.h2.value

public Class CompareModeDefault

extends CompareMode
Class Inheritance
Imports
java.text.CollationKey, .Collator, org.h2.engine.SysProperties, org.h2.message.DbException, org.h2.util.SmallLRUCache

The default implementation of CompareMode. It uses java.text.Collator.

Field Summary

Modifier and TypeField and Description
private volatile CompareModeDefault
private final SmallLRUCache<String, CollationKey>
private final Collator
Inherited from org.h2.value.CompareMode:
CHARSETDEFAULTICU4JOFF

Constructor Summary

AccessConstructor and Description
protected
CompareModeDefault(String name, int strength)

Method Summary

Modifier and TypeMethod and Description
public int
compareString(String
the first string
a
,
String
the second string
b
,
boolean
true if a case-insensitive comparison should be made
ignoreCase
)

Overrides org.h2.value.CompareMode.compareString.

Compare two strings.

public boolean
equalsChars(String
the first string
a
,
int
the character index in the first string
ai
,
String
the second string
b
,
int
the character index in the second string
bi
,
boolean
true if a case-insensitive comparison should be made
ignoreCase
)

Overrides org.h2.value.CompareMode.equalsChars.

Compare two characters in a string.

private CollationKey
Inherited from org.h2.value.CompareMode:
comparecompareLocaleNamesequalsgetCollationLocalesgetCollatorgetInstancegetNamegetNamegetStrengthhashCode

Field Detail

caseInsensitiveback to summary
private volatile CompareModeDefault caseInsensitive
collationKeysback to summary
private final SmallLRUCache<String, CollationKey> collationKeys
collatorback to summary
private final Collator collator

Constructor Detail

CompareModeDefaultback to summary
protected CompareModeDefault(String name, int strength)

Method Detail

compareStringback to summary
public int compareString(String a, String b, boolean ignoreCase)

Overrides org.h2.value.CompareMode.compareString.

Doc from org.h2.value.CompareMode.compareString.

Compare two strings.

Parameters
a:String

the first string

b:String

the second string

ignoreCase:boolean

true if a case-insensitive comparison should be made

Returns:int

-1 if the first string is 'smaller', 1 if the second string is smaller, and 0 if they are equal

Annotations
@Override
equalsCharsback to summary
public boolean equalsChars(String a, int ai, String b, int bi, boolean ignoreCase)

Overrides org.h2.value.CompareMode.equalsChars.

Doc from org.h2.value.CompareMode.equalsChars.

Compare two characters in a string.

Parameters
a:String

the first string

ai:int

the character index in the first string

b:String

the second string

bi:int

the character index in the second string

ignoreCase:boolean

true if a case-insensitive comparison should be made

Returns:boolean

true if the characters are equals

Annotations
@Override
getKeyback to summary
private CollationKey getKey(String a)