Class KeySegment

java.lang.Object
com.basis.filesystem.util.KeySegment
All Implemented Interfaces:
Serializable

public final class KeySegment extends Object implements Serializable
Class used to describe individual key segments of derived keys in MKEYED and XKEYED files.
See Also:
  • Field Details

  • Constructor Details

    • KeySegment

      public KeySegment()
    • KeySegment

      @Deprecated public KeySegment(int p_fieldNumber, int p_offset, int p_length, boolean p_descending, boolean p_bus) throws FilesystemException
      Deprecated.
      Constructor
      Parameters:
      p_fieldNumber - Number of field to start segment on -- start at beginning of record if 0.
      p_offset - Offset within field to start at.
      p_length - How many bytes the segment consists of.
      p_descending - If true then segment is descending.
      p_bus - If true the segment is an 8 byte business math value.
      Throws:
      FilesystemException - If a filesystem problem occurs.
    • KeySegment

      public KeySegment(int p_fieldNumber, int p_offset, int p_length, boolean p_descending, int p_special) throws FilesystemException
      Constructor
      Parameters:
      p_fieldNumber - Number of field to start segment on -- start at beginning of record if 0.
      p_offset - Offset within field to start at.
      p_length - How many bytes the segment consists of.
      p_descending - If true then segment is descending.
      p_special - Special segment type.
      Throws:
      FilesystemException - If a filesystem problem occurs.
  • Method Details

    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getSpecialType

      public int getSpecialType()
      Get special type.
      Returns:
      Special type.
    • getField

      public int getField()
      Get field.
      Returns:
      Field number.
    • getOffset

      public int getOffset()
      Get offset.
      Returns:
      Offset.
    • getLength

      public int getLength()
      Get length.
      Returns:
      Length.
    • isDescending

      public boolean isDescending()
      Get descending.
      Returns:
      true if segment is descending.
    • isBUS

      public boolean isBUS()
      Get bus.
      Returns:
      true if segment is numeric.
    • isNumeric

      @Deprecated public boolean isNumeric()
      Deprecated.
      Get bus. Deprecated method.
      Returns:
      true if segment is numeric.
    • isOrderedNumeric

      public boolean isOrderedNumeric()
      Get ordered numeric.
      Returns:
      true if segment is ordered numeric.
    • isCaseInsensitive

      public boolean isCaseInsensitive()
      Get case insensitive.
      Returns:
      true if segment is ordered numeric.
    • isNormal

      public boolean isNormal()
      Is this segment normal.
      Returns:
      true if segment is normal.
    • getSegmentForRecord

      protected final int getSegmentForRecord(String p_filename, io.netty.buffer.ByteBuf p_record, int p_actualRecordSize, io.netty.buffer.ByteBuf p_key, boolean p_checkFields, Charset p_charset) throws FilesystemException
      Get segment from a record.
      Parameters:
      p_filename -
      p_record - Record to get segment from.
      p_key - Buffer to put segment in.
      p_checkFields - Should field existence be enforced?
      p_charset - Charset for encode/decode strings.
      Throws:
      FilesystemException
    • getAndFixSegmentForRecord

      protected final void getAndFixSegmentForRecord(String p_filename, io.netty.buffer.ByteBuf p_record, int p_actualRecordSize, io.netty.buffer.ByteBuf p_key, boolean p_checkFields, Locale p_locale, Charset p_charset, boolean p_mangle) throws FilesystemException
      Both get and fix a key segment for a record.
      Parameters:
      p_filename -
      p_record -
      p_actualRecordSize -
      p_key -
      p_checkFields -
      p_locale -
      p_charset -
      p_mangle -
      Throws:
      FilesystemException
    • fixDescendingSegment

      protected final void fixDescendingSegment(io.netty.buffer.ByteBuf p_fromKey, io.netty.buffer.ByteBuf p_toKey, Locale p_locale, Charset p_charset, boolean p_mangle)
      Fix descending segment so that it is switched to/from normal.
      Parameters:
      p_fromKey - Key to convert.
      p_toKey - Key buffer to fill.
      p_locale - Locale for case insensitive.
      p_charset - Charset for decoding/encoding strings.
      p_mangle - true if numeric fields should be adjusted for descending.
    • toString

      public String toString()
      Overrides:
      toString in class Object