java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.nd.db.ShortString
All Implemented Interfaces:
IString

public class ShortString extends Object implements IString
This is for strings that fit inside a single chunk.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ShortString​(Database db, char[] chars, boolean useBytes)
     
    ShortString​(Database db, long offset)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compare​(char[] other, boolean caseSensitive)
    Compare this IString record and the specified character array
    static int
    compare​(char[] chars, char[] other, boolean caseSensitive)
     
    int
    compare​(String other, boolean caseSensitive)
    Compare this IString record and the specified String object
    int
    compare​(IString string, boolean caseSensitive)
    Compare this IString record and the specified IString record
    static int
    compareChars​(char a, char b, boolean caseSensitive)
    Compare characters case-sensitively, or case-insensitively.
    int
    Compare this IString record and the specified char array in a case sensitive manner such that it is compatible with case insensitive comparison.
    static int
    compareCompatibleWithIgnoreCase​(char[] chars, char[] other)
     
    int
    Compare this IString record and the specified IString record in a case sensitive manner such that it is compatible with case insensitive comparison.
    int
    comparePrefix​(char[] other, boolean caseSensitive)
    Compare this IString record and the specified character array
    static int
    comparePrefix​(char[] chars, char[] other, boolean caseSensitive)
     
    void
    Free the associated record in the Nd
    boolean
    equals​(Object obj)
     
    char[]
    Get an equivalent character array to this IString record
    long
    Get the offset of this IString record in the Nd
    Get an equivalent String object to this IString record
    int
    Compatible with String.hashCode()
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • MAX_BYTE_LENGTH

      public static final int MAX_BYTE_LENGTH
  • Constructor Details

  • Method Details

    • getRecord

      public long getRecord()
      Description copied from interface: IString
      Get the offset of this IString record in the Nd
      Specified by:
      getRecord in interface IString
    • delete

      public void delete() throws IndexException
      Description copied from interface: IString
      Free the associated record in the Nd
      Specified by:
      delete in interface IString
      Throws:
      IndexException
    • getChars

      public char[] getChars() throws IndexException
      Description copied from interface: IString
      Get an equivalent character array to this IString record

      N.B. This method can be expensive: compare and equals can be used for efficient comparisons

      Specified by:
      getChars in interface IString
      Returns:
      an equivalent character array to this IString record
      Throws:
      IndexException
    • getString

      public String getString() throws IndexException
      Description copied from interface: IString
      Get an equivalent String object to this IString record

      N.B. This method can be expensive: compare and equals can be used for efficient comparisons

      Specified by:
      getString in interface IString
      Returns:
      an equivalent String object to this IString record
      Throws:
      IndexException
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Compatible with String.hashCode()
      Overrides:
      hashCode in class Object
    • compare

      public static int compare(char[] chars, char[] other, boolean caseSensitive)
    • compare

      public int compare(char[] other, boolean caseSensitive) throws IndexException
      Description copied from interface: IString
      Compare this IString record and the specified character array
      Specified by:
      compare in interface IString
      caseSensitive - whether to compare in a case-sensitive way
      Returns:
      • -1 if this < chars
      • 0 if this == chars
      • 1 if this > chars
      Throws:
      IndexException
    • compare

      public int compare(IString string, boolean caseSensitive) throws IndexException
      Description copied from interface: IString
      Compare this IString record and the specified IString record
      Specified by:
      compare in interface IString
      caseSensitive - whether to compare in a case-sensitive way
      Returns:
      • -1 if this < string
      • 0 if this == string
      • 1 if this > string
      Throws:
      IndexException
    • compare

      public int compare(String other, boolean caseSensitive) throws IndexException
      Description copied from interface: IString
      Compare this IString record and the specified String object
      Specified by:
      compare in interface IString
      caseSensitive - whether to compare in a case-sensitive way
      Returns:
      • -1 if this < string
      • 0 if this == string
      • 1 if this > string
      Throws:
      IndexException
    • compareCompatibleWithIgnoreCase

      public int compareCompatibleWithIgnoreCase(IString string) throws IndexException
      Description copied from interface: IString
      Compare this IString record and the specified IString record in a case sensitive manner such that it is compatible with case insensitive comparison.
      Specified by:
      compareCompatibleWithIgnoreCase in interface IString
      Returns:
      • -1 if this < string
      • 0 if this == string
      • 1 if this > string
      Throws:
      IndexException
    • compareCompatibleWithIgnoreCase

      public int compareCompatibleWithIgnoreCase(char[] other) throws IndexException
      Description copied from interface: IString
      Compare this IString record and the specified char array in a case sensitive manner such that it is compatible with case insensitive comparison.
      Specified by:
      compareCompatibleWithIgnoreCase in interface IString
      Returns:
      • -1 if this < string
      • 0 if this == string
      • 1 if this > string
      Throws:
      IndexException
    • compareCompatibleWithIgnoreCase

      public static int compareCompatibleWithIgnoreCase(char[] chars, char[] other)
    • comparePrefix

      public int comparePrefix(char[] other, boolean caseSensitive) throws IndexException
      Description copied from interface: IString
      Compare this IString record and the specified character array
      Specified by:
      comparePrefix in interface IString
      Parameters:
      other - the name to compare to
      caseSensitive - whether to compare in a case-sensitive way
      Returns:
      • -1 if this < chars
      • 0 if this has a prefix chars
      • 1 if this > chars and does not have the prefix
      Throws:
      IndexException
    • comparePrefix

      public static int comparePrefix(char[] chars, char[] other, boolean caseSensitive)
    • compareChars

      public static int compareChars(char a, char b, boolean caseSensitive)
      Compare characters case-sensitively, or case-insensitively. Limitation This only maps the range a-z,A-Z onto each other
      Parameters:
      a - a character
      b - a character
      caseSensitive - whether to compare case-sensitively
      Returns:
      • -1 if a < b
      • 0 if a == b
      • 1 if a > b
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • length

      public int length()
      Specified by:
      length in interface IString
      Returns:
      the length of the string