1 package org.sat4j.core;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 import java.util.Comparator;
31 import java.util.Iterator;
32
33 import org.sat4j.specs.IVec;
34
35
36
37
38
39
40
41
42
43 public class ReadOnlyVec<T> implements IVec<T> {
44
45
46
47
48 private static final long serialVersionUID = 1L;
49
50 private final IVec<T> vec;
51
52 public ReadOnlyVec(IVec<T> vec) {
53 this.vec = vec;
54 }
55
56 public void clear() {
57 throw new UnsupportedOperationException();
58 }
59
60 public void copyTo(IVec<T> copy) {
61 vec.copyTo(copy);
62 }
63
64 public <E> void copyTo(E[] dest) {
65 vec.copyTo(dest);
66 }
67
68 public T delete(int i) {
69 throw new UnsupportedOperationException();
70 }
71
72 public void ensure(int nsize) {
73 throw new UnsupportedOperationException();
74
75 }
76
77 public T get(int i) {
78 return vec.get(i);
79 }
80
81 public void growTo(int newsize, T pad) {
82 throw new UnsupportedOperationException();
83 }
84
85 public void insertFirst(T elem) {
86 throw new UnsupportedOperationException();
87 }
88
89 public void insertFirstWithShifting(T elem) {
90 throw new UnsupportedOperationException();
91 }
92
93 public boolean isEmpty() {
94 return vec.isEmpty();
95 }
96
97 public Iterator<T> iterator() {
98 return vec.iterator();
99 }
100
101 public T last() {
102 return vec.last();
103 }
104
105 public void moveTo(IVec<T> dest) {
106 throw new UnsupportedOperationException();
107 }
108
109 public void moveTo(int dest, int source) {
110 throw new UnsupportedOperationException();
111 }
112
113 public void pop() {
114 throw new UnsupportedOperationException();
115 }
116
117 public IVec<T> push(Object elem) {
118 throw new UnsupportedOperationException();
119 }
120
121 public void remove(Object elem) {
122 throw new UnsupportedOperationException();
123 }
124
125 public void set(int i, Object o) {
126 throw new UnsupportedOperationException();
127 }
128
129 public void shrink(int nofelems) {
130 throw new UnsupportedOperationException();
131 }
132
133 public void shrinkTo(int newsize) {
134 throw new UnsupportedOperationException();
135 }
136
137 public int size() {
138 return vec.size();
139 }
140
141 public void sort(Comparator<T> comparator) {
142 throw new UnsupportedOperationException();
143 }
144
145 public void sortUnique(Comparator<T> comparator) {
146 throw new UnsupportedOperationException();
147 }
148
149 @SuppressWarnings("unchecked")
150 public T[] toArray() {
151 T[] array = (T[]) new Object[vec.size()];
152 vec.copyTo(array);
153 return array;
154 }
155
156 public void unsafePush(T elem) {
157 throw new UnsupportedOperationException();
158 }
159
160
161
162
163 public boolean contains(T element) {
164 return vec.contains(element);
165 }
166 }