01: /*
02: * @(#)CharSequenceList.java 1.2 04/12/06
03: *
04: * Copyright (c) 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package pnuts.regex.jsr51;
10:
11: import java.util.*;
12:
13: class CharSequenceList extends AbstractList {
14: private CharSequence text;
15: private int[] start;
16: private int[] end;
17:
18: protected CharSequenceList() {
19: }
20:
21: public CharSequenceList(CharSequence text, int[] start, int[] end) {
22: this .text = text;
23: this .start = start;
24: this .end = end;
25: }
26:
27: public Object get(int index) {
28: return text.subSequence(start[index], end[index]);
29: }
30:
31: public Object set(int index, Object value) {
32: throw new UnsupportedOperationException();
33: }
34:
35: public int size() {
36: return start.length;
37: }
38: }
|