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