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