org.basex.query.util
Class Collation

java.lang.Object
  extended by org.basex.query.util.Collation

public final class Collation
extends java.lang.Object

This class organizes collations. Some of the core functions have been inspired by the Saxon HE source code.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Method Summary
 byte[] after(byte[] string, byte[] sub, InputInfo info)
          Returns the substring after a specified string.
 byte[] before(byte[] string, byte[] sub, InputInfo info)
          Returns the substring before a specified string.
 int compare(byte[] string, byte[] compare)
          Compares two strings.
 boolean contains(byte[] string, byte[] sub, InputInfo info)
          Checks if a string is contained in another.
 boolean endsWith(byte[] string, byte[] sub, InputInfo info)
          Checks if a string ends with another.
static Collation get(byte[] uri, QueryContext ctx, InputInfo info, Err err)
          Returns a collation instance for the specified uri.
 boolean startsWith(byte[] string, byte[] sub, InputInfo info)
          Checks if a string starts with another.
 byte[] uri()
          Returns the collation URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static Collation get(byte[] uri,
                            QueryContext ctx,
                            InputInfo info,
                            Err err)
                     throws QueryException
Returns a collation instance for the specified uri.

Parameters:
uri - collation uri
ctx - query context
info - input info
err - error code for unknown collation uris
Returns:
collator instance or null for unicode point collation
Throws:
QueryException - query exception

compare

public int compare(byte[] string,
                   byte[] compare)
Compares two strings.

Parameters:
string - string
compare - string to be compared
Returns:
result of check

contains

public boolean contains(byte[] string,
                        byte[] sub,
                        InputInfo info)
                 throws QueryException
Checks if a string is contained in another.

Parameters:
string - string
sub - substring to be found
info - input info
Returns:
result of check
Throws:
QueryException - query exception

startsWith

public boolean startsWith(byte[] string,
                          byte[] sub,
                          InputInfo info)
                   throws QueryException
Checks if a string starts with another.

Parameters:
string - string
sub - substring to be found
info - input info
Returns:
result of check
Throws:
QueryException - query exception

endsWith

public boolean endsWith(byte[] string,
                        byte[] sub,
                        InputInfo info)
                 throws QueryException
Checks if a string ends with another.

Parameters:
string - string
sub - substring to be found
info - input info
Returns:
result of check
Throws:
QueryException - query exception

after

public byte[] after(byte[] string,
                    byte[] sub,
                    InputInfo info)
             throws QueryException
Returns the substring after a specified string.

Parameters:
string - string
sub - substring to be found
info - input info
Returns:
substring
Throws:
QueryException - query exception

before

public byte[] before(byte[] string,
                     byte[] sub,
                     InputInfo info)
              throws QueryException
Returns the substring before a specified string.

Parameters:
string - string
sub - substring to be found
info - input info
Returns:
substring
Throws:
QueryException - query exception

uri

public byte[] uri()
Returns the collation URI.

Returns:
uri