You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IndexCodes.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. Copyright (c) 2008 Health Market Science, Inc.
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with this library; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  14. USA
  15. You can contact Health Market Science at info@healthmarketscience.com
  16. or at the following address:
  17. Health Market Science
  18. 2700 Horizon Drive
  19. Suite 200
  20. King of Prussia, PA 19406
  21. */
  22. package com.healthmarketscience.jackcess;
  23. /**
  24. * Various constants used for creating index entries.
  25. *
  26. * @author James Ahlborn
  27. */
  28. public class IndexCodes {
  29. static final byte ASC_START_FLAG = (byte)0x7F;
  30. static final byte ASC_NULL_FLAG = (byte)0x00;
  31. static final byte DESC_START_FLAG = (byte)0x80;
  32. static final byte DESC_NULL_FLAG = (byte)0xFF;
  33. static final byte MID_GUID = (byte)0x09;
  34. static final byte ASC_END_GUID = (byte)0x08;
  35. static final byte DESC_END_GUID = (byte)0xF7;
  36. static final byte ASC_BOOLEAN_TRUE = (byte)0x00;
  37. static final byte ASC_BOOLEAN_FALSE = (byte)0xFF;
  38. static final byte DESC_BOOLEAN_TRUE = ASC_BOOLEAN_FALSE;
  39. static final byte DESC_BOOLEAN_FALSE = ASC_BOOLEAN_TRUE;
  40. static boolean isNullEntry(byte startEntryFlag) {
  41. return((startEntryFlag == ASC_NULL_FLAG) ||
  42. (startEntryFlag == DESC_NULL_FLAG));
  43. }
  44. static byte getNullEntryFlag(boolean isAscending) {
  45. return(isAscending ? ASC_NULL_FLAG : DESC_NULL_FLAG);
  46. }
  47. static byte getStartEntryFlag(boolean isAscending) {
  48. return(isAscending ? ASC_START_FLAG : DESC_START_FLAG);
  49. }
  50. }