Debian Codegraph @

rhino/src/org/mozilla/javascript/regexp/SubString.java

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 package org.mozilla.javascript.regexp;
8
9 /**
10 * A utility class for lazily instantiated substrings.
11 */
12 public class SubString {
13
14 public SubString()
15 {
16 }
17
18 public SubString(String str)
19 {
20 this.str = str;
21 index = 0;
22 length = str.length();
23 }
24
25 public SubString(String source, int start, int len)
26 {
27 str = source;
28 index = start;
29 length = len;
30 }
31
32 @Override
33 public String toString() {
34 return str == null
35 ? ""
36 : str.substring(index, index + length);
37 }
38
39 public static final SubString emptySubString = new SubString();
40
41 String str;
42 int index;
43 int length;
44 }
45