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