Sequence.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright (c) 2001, 2003 Per M.A. Bothner and Brainfood Inc.
  2. // This is free software; for terms and warranty disclaimer see ./COPYING.
  3. package gnu.lists;
  4. import gnu.kawa.util.BoundedHashable;
  5. /**
  6. * A Sequence is an ordered list of elements.
  7. * It is similar to and compatible with the Java2 java.util.List interface,
  8. * but does not require it.
  9. *
  10. * All standard classes that implement Sequence also extend AbstractSequence.
  11. * Using AbstractSequence provides default implementations for many methods,
  12. * and also makes things a bit more efficient. However, client code should
  13. * use Sequence rather than AbstractSequence.
  14. *
  15. * @author Per Bothner
  16. */
  17. public interface Sequence<E>
  18. extends java.util.List<E>, Consumable, BoundedHashable
  19. {
  20. /** Special magic end-of-file marker. */
  21. public static final Object eofValue = EofClass.eofValue;
  22. /** True is this sequence contains no elements. */
  23. public boolean isEmpty();
  24. /** See java.util.List. */
  25. public int size();
  26. /** See java.util.List. */
  27. public E get (int index);
  28. public int getInt(int arg1);
  29. /** See java.util.List. */
  30. public E set (int index, E value);
  31. public void fill(E value);
  32. public java.util.Enumeration<E> elements();
  33. /** Return code used to indicate a position is at end of the sequence. */
  34. public static final int EOF_VALUE = 0;
  35. public static final int PRIM_VALUE = 16;
  36. public static final int INT_U8_VALUE = PRIM_VALUE + 1;
  37. public static final int INT_S8_VALUE = PRIM_VALUE + 2;
  38. public static final int INT_U16_VALUE = PRIM_VALUE + 3;
  39. public static final int INT_S16_VALUE = PRIM_VALUE + 4;
  40. public static final int INT_U32_VALUE = PRIM_VALUE + 5;
  41. public static final int INT_S32_VALUE = PRIM_VALUE + 6;
  42. public static final int INT_U64_VALUE = PRIM_VALUE + 7;
  43. public static final int INT_S64_VALUE = PRIM_VALUE + 8;
  44. /** Return code used to indicate next element is 32-bit float. */
  45. public static final int FLOAT_VALUE = PRIM_VALUE + 9;
  46. /** Return code used to indicate next element is 64-bit double. */
  47. public static final int DOUBLE_VALUE = PRIM_VALUE + 10;
  48. public static final int BOOLEAN_VALUE = PRIM_VALUE + 11;
  49. /** A byte in an encoded string.
  50. * Part of a char, in contrast with INT_S8_VALUE, which is an integer. */
  51. public static final int TEXT_BYTE_VALUE = PRIM_VALUE + 12;
  52. public static final int CHAR_VALUE = PRIM_VALUE + 13;
  53. public static final int CDATA_VALUE = 31;
  54. public static final int OBJECT_VALUE = 32;
  55. public static final int ELEMENT_VALUE = 33;
  56. public static final int DOCUMENT_VALUE = 34;
  57. public static final int ATTRIBUTE_VALUE = 35;
  58. public static final int COMMENT_VALUE = 36;
  59. public static final int PROCESSING_INSTRUCTION_VALUE = 37;
  60. /*
  61. public static final int NAMESPACE_ATTRIBUTE_VALUE = 16;
  62. public static final int ENTITY_REFERENCE_VALUE = 16;
  63. */
  64. }