Skip to content

Commit 555ce3f

Browse files
committed
stash in case needed in future
1 parent 090c3ec commit 555ce3f

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

attic/ImmutableBitSet.java

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package com.fasterxml.jackson.databind.util;
2+
3+
import java.util.BitSet;
4+
5+
public class ImmutableBitSet extends BitSet
6+
{
7+
private static final long serialVersionUID = 1L;
8+
9+
private ImmutableBitSet(BitSet bits) {
10+
super();
11+
_parentOr(bits);
12+
}
13+
14+
public static ImmutableBitSet of(BitSet bits) {
15+
return new ImmutableBitSet(bits);
16+
}
17+
18+
private void _parentOr(BitSet set) {
19+
super.or(set);
20+
}
21+
22+
@Override
23+
public void and(BitSet set) {
24+
_failMutableOperation();
25+
}
26+
27+
@Override
28+
public void andNot(BitSet set) {
29+
_failMutableOperation();
30+
}
31+
32+
@Override
33+
public void or(BitSet set) {
34+
_failMutableOperation();
35+
}
36+
37+
@Override
38+
public void xor(BitSet set) {
39+
_failMutableOperation();
40+
}
41+
42+
@Override
43+
public void clear() {
44+
_failMutableOperation();
45+
}
46+
47+
@Override
48+
public void clear(int ix) {
49+
_failMutableOperation();
50+
}
51+
52+
@Override
53+
public void clear(int from, int to) {
54+
_failMutableOperation();
55+
}
56+
57+
@Override
58+
public void flip(int bitIndex) {
59+
_failMutableOperation();
60+
}
61+
62+
@Override
63+
public void flip(int from, int to) {
64+
_failMutableOperation();
65+
}
66+
67+
@Override
68+
public void set(int bitIndex) {
69+
_failMutableOperation();
70+
}
71+
72+
@Override
73+
public void set(int bitIndex, boolean state) {
74+
_failMutableOperation();
75+
}
76+
77+
@Override
78+
public void set(int from, int to) {
79+
_failMutableOperation();
80+
}
81+
82+
private void _failMutableOperation() {
83+
throw new UnsupportedOperationException("ImmutableBitSet does not support modification");
84+
}
85+
}

0 commit comments

Comments
 (0)