Class Collation

java.lang.Object
org.basex.query.util.collation.Collation

public abstract class Collation extends Object
This class organizes collations.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static enum 
    Search modes.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final byte[]
    after(byte[] string, byte[] sub, InputInfo ii)
    Returns the substring after a specified string.
    final byte[]
    before(byte[] string, byte[] sub, InputInfo ii)
    Returns the substring before a specified string.
    abstract int
    compare(byte[] string, byte[] compare)
    Compares two strings.
    final boolean
    contains(byte[] string, byte[] sub, InputInfo ii)
    Checks if a string is contained in another.
    final boolean
    endsWith(byte[] string, byte[] sub, InputInfo ii)
    Checks if a string ends with another.
    static Collation
    get(byte[] uri, QueryContext qc, StaticContext sc, InputInfo ii, QueryError err)
    Returns a collation instance for the specified uri.
    protected abstract int
    indexOf(String string, String sub, Collation.Mode mode, InputInfo info)
    Returns the start or end position of the specified substring.
    final boolean
    startsWith(byte[] string, byte[] sub, InputInfo ii)
    Checks if a string starts with another.
    final byte[]
    uri()
    Returns the collation URI.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Collation

      public Collation()
  • Method Details

    • get

      public static Collation get(byte[] uri, QueryContext qc, StaticContext sc, InputInfo ii, QueryError err) throws QueryException
      Returns a collation instance for the specified uri.
      Parameters:
      uri - collation uri
      qc - query context
      sc - static context
      ii - input info
      err - error code for unknown collation uris
      Returns:
      collator instance or null for unicode point collation
      Throws:
      QueryException - query exception
    • contains

      public final boolean contains(byte[] string, byte[] sub, InputInfo ii) throws QueryException
      Checks if a string is contained in another.
      Parameters:
      string - string
      sub - substring to be found
      ii - input info
      Returns:
      result of check
      Throws:
      QueryException - query exception
    • startsWith

      public final boolean startsWith(byte[] string, byte[] sub, InputInfo ii) throws QueryException
      Checks if a string starts with another.
      Parameters:
      string - string
      sub - substring to be found
      ii - input info
      Returns:
      result of check
      Throws:
      QueryException - query exception
    • endsWith

      public final boolean endsWith(byte[] string, byte[] sub, InputInfo ii) throws QueryException
      Checks if a string ends with another.
      Parameters:
      string - string
      sub - substring to be found
      ii - input info
      Returns:
      result of check
      Throws:
      QueryException - query exception
    • after

      public final byte[] after(byte[] string, byte[] sub, InputInfo ii) throws QueryException
      Returns the substring after a specified string.
      Parameters:
      string - string
      sub - substring to be found
      ii - input info
      Returns:
      substring
      Throws:
      QueryException - query exception
    • before

      public final byte[] before(byte[] string, byte[] sub, InputInfo ii) throws QueryException
      Returns the substring before a specified string.
      Parameters:
      string - string
      sub - substring to be found
      ii - input info
      Returns:
      substring
      Throws:
      QueryException - query exception
    • uri

      public final byte[] uri()
      Returns the collation URI.
      Returns:
      uri
    • compare

      public abstract int compare(byte[] string, byte[] compare)
      Compares two strings.
      Parameters:
      string - string
      compare - string to be compared
      Returns:
      result of check
    • indexOf

      protected abstract int indexOf(String string, String sub, Collation.Mode mode, InputInfo info) throws QueryException
      Returns the start or end position of the specified substring.
      Parameters:
      string - string
      sub - substring to be found
      mode - search mode
      info - input info
      Returns:
      string index
      Throws:
      QueryException - query exception