You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OneCharIterator.java 781B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.fo;
  8. import java.util.Iterator;
  9. import java.util.NoSuchElementException;
  10. public class OneCharIterator extends AbstractCharIterator {
  11. private boolean bFirst=true;
  12. private char charCode;
  13. public OneCharIterator(char c) {
  14. this.charCode = c;
  15. }
  16. public boolean hasNext() {
  17. return bFirst;
  18. }
  19. public char nextChar() throws NoSuchElementException {
  20. if (bFirst) {
  21. bFirst = false;
  22. return charCode;
  23. } else {
  24. throw new NoSuchElementException();
  25. }
  26. }
  27. }