01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package java.lang;
19:
20: /**
21: * The CharSequence interface represents an ordered set of characters and the
22: * functions to probe them.
23: */
24: public interface CharSequence {
25:
26: /**
27: * Answers the number of characters in the sequence.
28: *
29: * @return the number of characters in the sequence
30: */
31: public int length();
32:
33: /**
34: * Answers the character at the specified index (0-based indexing).
35: *
36: * @param index -
37: * of the character to return
38: * @return character indicated by index
39: * @throws IndexOutOfBoundsException
40: * when <code>index < 0</code> or
41: * <code>index</code> >= the length of the <code>CharSequence</code>
42: */
43: public char charAt(int index);
44:
45: /**
46: * Answers a CharSequence from the <code>start</code> index to the
47: * <code>end</code> index of this sequence.
48: *
49: * @param start -- index of the start of the sub-sequence to return
50: * @param end -- index of the end of the sub-sequence to return
51: * @return the sub sequence from start to end
52: * @throws IndexOutOfBoundsException when 1. either index is below 0
53: * 2. either index >= <code>this.length()</code>
54: * 3. <code>start > end </code>
55: */
56: public CharSequence subSequence(int start, int end);
57:
58: /**
59: * Answers a String with the same characters and ordering of this
60: * CharSequence
61: *
62: * @return a String based on the CharSequence
63: */
64: public String toString();
65: }
|