1 7 8 package com.ibm.icu.impl; 9 10 import java.text.CharacterIterator ; 11 12 import com.ibm.icu.text.*; 13 14 19 public class UCharacterIteratorWrapper implements CharacterIterator { 20 21 public UCharacterIteratorWrapper(UCharacterIterator iter){ 22 this.iterator = iter; 23 } 24 25 private UCharacterIterator iterator; 26 27 28 34 public char first(){ 35 iterator.setToStart(); 37 return (char)iterator.current(); 38 } 39 40 46 public char last(){ 47 iterator.setToLimit(); 48 return (char)iterator.previous(); 49 } 50 51 57 public char current(){ 58 return (char) iterator.current(); 59 } 60 61 69 public char next(){ 70 iterator.next(); 72 return (char) iterator.current(); 73 } 74 75 82 public char previous(){ 83 return (char) iterator.previous(); 85 } 86 87 95 public char setIndex(int position){ 96 iterator.setIndex(position); 97 return (char) iterator.current(); 98 } 99 100 104 public int getBeginIndex(){ 105 return 0; 107 } 108 109 114 public int getEndIndex(){ 115 return iterator.getLength(); 116 } 117 118 122 public int getIndex(){ 123 return iterator.getIndex(); 124 } 125 126 130 public Object clone(){ 131 try { 132 UCharacterIteratorWrapper result = (UCharacterIteratorWrapper) super.clone(); 133 result.iterator = (UCharacterIterator)this.iterator.clone(); 134 return result; 135 } catch (CloneNotSupportedException e) { 136 return null; } 138 } 139 140 } 141 142 | Popular Tags |