01 /*
02  *  JScripter Emulation 1.0 - To Script Java
03  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
04  *  
05  *  This program is free software: you can redistribute it and/or modify
06  *  it under the terms of the GNU Affero General Public License as published by
07  *  the Free Software Foundation, either version 3 of the License, or
08  *  (at your option) any later version.
09  *  
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *  
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.jscripter.emu.java.lang;
20 
21 /**
22  * <p><b>Internally</b> represents a readable sequence of char values, emulating a
23  * standard <tt>java.lang</tt> interface or class with the same simple name as
24  * this one.</p>
25  * <p>This interface or class is only used internally by JS re-compiler implementations.</p>
26  * <p>Please refer to <a href="http://java.sun.com/docs/">the Java API
27  * Standards</a> for detail description of the original class or interface.</p>
28  * 
29  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
30  * 
31  * @javascript Re-compilers must redirect the resolution of the emulated original Java class or interface to this one.
32  */
33 public interface CharSequence
34 {
35     /**
36      * <p>Returns the char value at the specified index.</p>
37      * @param index The index of the char value to be returned. An index ranges from zero to 
38      * <tt>{@link #length()} - 1</tt>.
39      * @return The specified char value.
40      * @since 1.0
41      * @javascript Re-compilers must report error on end-users directly using this method.
42      */
43     char charAt(int index);
44 
45     /**
46      * <p>Returns the length of this character sequence.</p>
47      * @return The number of chars in this sequence.
48      * @since 1.0
49      * @javascript Re-compilers must report error on end-users directly using this method.
50      */
51     int length();
52 
53     /**
54      * <p>Returns a new {@link CharSequence} that is a subsequence of this sequence.</p>
55      * <p>The subsequence starts with the char value at the specified <tt>index</tt> and ends with 
56      * the char value at index <tt>end - 1</tt>. The length (in chars) of the returned sequence is 
57      * <tt>end - start</tt>, so if <tt>start == end</tt> then an empty sequence is returned.</p>
58      * @param start The start index, inclusive.
59      * @param end The end index, exclusive.
60      * @return The specified subsequence.
61      * @since 1.0
62      * @javascript Re-compilers must report error on end-users directly using this method.
63      */
64     CharSequence subSequence(int start, int end);
65 
66     /**
67      * <p>Returns a string containing the characters in this sequence in the same
68      * order as this sequence. </p>
69      * <p>The length of the string will be the length of this sequence.</p>
70      * @return A string consisting of exactly this sequence of characters.
71      * @since 1.0
72      * @javascript Re-compilers must report error on end-users directly using this method.
73      */
74     java.lang.String toString();
75 }