1 package org.unicode.cldr.draft; 2 3 import java.util.BitSet; 4 5 public class UnmodifiableBitSet extends BitSet { 6 7 private static final long serialVersionUID = 2506181560723087578L; 8 9 public UnmodifiableBitSet(BitSet s) { 10 // clone for safety 11 super.clear(); 12 super.or(s); 13 } UnicodeSetFilteredTransform(UnicodeSet filter, StringTransform result)14 15 public BitSet getModifiableBitset() { 16 // clone for safety 17 BitSet result = new BitSet(); 18 result.or(this); 19 return result; 20 } getNextRegion(String text, int[] startEnd)21 22 @Override 23 public void and(BitSet set) { 24 throw new UnsupportedOperationException("Cannot modify."); 25 } 26 27 @Override 28 public void andNot(BitSet set) { 29 throw new UnsupportedOperationException("Cannot modify."); 30 } 31 32 @Override 33 public void clear() { 34 throw new UnsupportedOperationException("Cannot modify."); 35 } 36 37 @Override 38 public void clear(int bitIndex) { 39 throw new UnsupportedOperationException("Cannot modify."); 40 } 41 42 @Override 43 public void clear(int fromIndex, int toIndex) { 44 throw new UnsupportedOperationException("Cannot modify."); 45 } 46 47 @Override 48 public void flip(int bitIndex) { 49 throw new UnsupportedOperationException("Cannot modify."); 50 } 51 52 @Override 53 public void flip(int fromIndex, int toIndex) { 54 throw new UnsupportedOperationException("Cannot modify."); toString()55 } 56 57 @Override 58 public void set(int bitIndex) { 59 throw new UnsupportedOperationException("Cannot modify."); 60 } 61 62 @Override 63 public void set(int bitIndex, boolean value) { 64 throw new UnsupportedOperationException("Cannot modify."); 65 } 66 67 @Override 68 public void set(int fromIndex, int toIndex) { 69 throw new UnsupportedOperationException("Cannot modify."); 70 } 71 72 @Override 73 public void set(int fromIndex, int toIndex, boolean value) { 74 throw new UnsupportedOperationException("Cannot modify."); 75 } 76 77 @Override 78 public void or(BitSet set) { 79 throw new UnsupportedOperationException("Cannot modify."); 80 } 81 82 @Override 83 public void xor(BitSet set) { 84 throw new UnsupportedOperationException("Cannot modify."); 85 } 86 87 // public void TestBitset() { 88 // BitSet s = new BitSet(); 89 // s.set(1); 90 // BitSet z = new BitSet(); 91 // z.set(2); 92 // 93 // UnmodifiableBitSet t = new UnmodifiableBitSet(s); 94 // try { 95 // t.clear(); 96 // errln("Failed to fail"); 97 // } catch (UnsupportedOperationException e){} 98 // try { 99 // t.or(z); 100 // errln("Failed to fail"); 101 // } catch (UnsupportedOperationException e){} 102 // z.or(t); 103 // } 104 105 } 106