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: /* $Id: CharIterator.java 426576 2006-07-28 15:44:37Z jeremias $ */
19:
20: package org.apache.fop.fo;
21:
22: import java.util.Iterator;
23: import java.util.NoSuchElementException;
24:
25: /**
26: * Abstract base class for iterators that should iterate through a series
27: * of characters. Extends the java.util.Iterator interface with some
28: * additional functions useful for FOP's management of text.
29: */
30: public abstract class CharIterator implements Iterator, Cloneable {
31:
32: /**
33: * @see java.util.Iterator#hasNext()
34: */
35: public abstract boolean hasNext();
36:
37: /**
38: * @return the character that is the next character in the collection
39: * @throws NoSuchElementException if there are no more characters (test for
40: * this condition with java.util.Iterator.hasNext()).
41: */
42: public abstract char nextChar() throws NoSuchElementException;
43:
44: /**
45: * @see java.util.Iterator#next()
46: */
47: public Object next() throws NoSuchElementException {
48: return new Character(nextChar());
49: }
50:
51: /**
52: * @see java.util.Iterator#remove()
53: */
54: public void remove() {
55: throw new UnsupportedOperationException();
56: }
57:
58: /**
59: * Replace the current character managed by the iterator with a specified
60: * character?
61: * @param c character
62: */
63: public void replaceChar(char c) {
64: }
65:
66: /**
67: * @see java.lang.Object#clone()
68: */
69: public Object clone() {
70: try {
71: return super .clone();
72: } catch (CloneNotSupportedException ex) {
73: return null;
74: }
75: }
76: }
|