src/com/sun/org/apache/regexp/internal/CharacterArrayCharacterIterator.java

changeset 2116
aaee9ae4799a
parent 2090
3b8ebb957957
parent 2115
ba503169016f
child 2117
a5f920b6d2b5
     1.1 --- a/src/com/sun/org/apache/regexp/internal/CharacterArrayCharacterIterator.java	Sat Oct 24 16:18:47 2020 +0800
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,76 +0,0 @@
     1.4 -/*
     1.5 - * reserved comment block
     1.6 - * DO NOT REMOVE OR ALTER!
     1.7 - */
     1.8 -/*
     1.9 - * Copyright 1999-2004 The Apache Software Foundation.
    1.10 - *
    1.11 - * Licensed under the Apache License, Version 2.0 (the "License");
    1.12 - * you may not use this file except in compliance with the License.
    1.13 - * You may obtain a copy of the License at
    1.14 - *
    1.15 - *     http://www.apache.org/licenses/LICENSE-2.0
    1.16 - *
    1.17 - * Unless required by applicable law or agreed to in writing, software
    1.18 - * distributed under the License is distributed on an "AS IS" BASIS,
    1.19 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.20 - * See the License for the specific language governing permissions and
    1.21 - * limitations under the License.
    1.22 - */
    1.23 -
    1.24 -package com.sun.org.apache.regexp.internal;
    1.25 -
    1.26 -/**
    1.27 - * Encapsulates char[] as CharacterIterator
    1.28 - *
    1.29 - * @author <a href="mailto:ales.novak@netbeans.com">Ales Novak</a>
    1.30 - */
    1.31 -public final class CharacterArrayCharacterIterator implements CharacterIterator
    1.32 -{
    1.33 -    /** encapsulated */
    1.34 -    private final char[] src;
    1.35 -    /** offset in the char array */
    1.36 -    private final int off;
    1.37 -    /** used portion of the array */
    1.38 -    private final int len;
    1.39 -
    1.40 -    /** @param src - encapsulated String */
    1.41 -    public CharacterArrayCharacterIterator(char[] src, int off, int len)
    1.42 -    {
    1.43 -        this.src = src;
    1.44 -        this.off = off;
    1.45 -        this.len = len;
    1.46 -    }
    1.47 -
    1.48 -    /** @return a substring */
    1.49 -    public String substring(int beginIndex, int endIndex)
    1.50 -    {
    1.51 -        if (endIndex > len) {
    1.52 -            throw new IndexOutOfBoundsException("endIndex=" + endIndex
    1.53 -                                                + "; sequence size=" + len);
    1.54 -        }
    1.55 -        if (beginIndex < 0 || beginIndex > endIndex) {
    1.56 -            throw new IndexOutOfBoundsException("beginIndex=" + beginIndex
    1.57 -                                                + "; endIndex=" + endIndex);
    1.58 -        }
    1.59 -        return new String(src, off + beginIndex, endIndex - beginIndex);
    1.60 -    }
    1.61 -
    1.62 -    /** @return a substring */
    1.63 -    public String substring(int beginIndex)
    1.64 -    {
    1.65 -        return substring(beginIndex, len);
    1.66 -    }
    1.67 -
    1.68 -    /** @return a character at the specified position. */
    1.69 -    public char charAt(int pos)
    1.70 -    {
    1.71 -        return src[off + pos];
    1.72 -    }
    1.73 -
    1.74 -    /** @return <tt>true</tt> iff if the specified index is after the end of the character stream */
    1.75 -    public boolean isEnd(int pos)
    1.76 -    {
    1.77 -        return (pos >= len);
    1.78 -    }
    1.79 -}

mercurial