|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
IVecInt | Line # 33 | 0 | 1 | - |
-1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
No Tests | |||
1 | /* | |
2 | * SAT4J: a SATisfiability library for Java Copyright (C) 2004-2006 Daniel Le Berre | |
3 | * | |
4 | * Based on the original minisat specification from: | |
5 | * | |
6 | * An extensible SAT solver. Niklas E?n and Niklas S?rensson. Proceedings of the | |
7 | * Sixth International Conference on Theory and Applications of Satisfiability | |
8 | * Testing, LNCS 2919, pp 502-518, 2003. | |
9 | * | |
10 | * This library is free software; you can redistribute it and/or modify it under | |
11 | * the terms of the GNU Lesser General Public License as published by the Free | |
12 | * Software Foundation; either version 2.1 of the License, or (at your option) | |
13 | * any later version. | |
14 | * | |
15 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
17 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
18 | * details. | |
19 | * | |
20 | * You should have received a copy of the GNU Lesser General Public License | |
21 | * along with this library; if not, write to the Free Software Foundation, Inc., | |
22 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 | * | |
24 | */ | |
25 | ||
26 | package org.sat4j.specs; | |
27 | ||
28 | /** | |
29 | * An abstraction for the vector of int used on the library. | |
30 | * | |
31 | * @author leberre | |
32 | */ | |
33 | public interface IVecInt extends Iterable<Integer> { | |
34 | ||
35 | public abstract int size(); | |
36 | ||
37 | /** | |
38 | * Remove the latest nofelems elements from the vector | |
39 | * | |
40 | * @param nofelems | |
41 | */ | |
42 | public abstract void shrink(int nofelems); | |
43 | ||
44 | public abstract void shrinkTo(int newsize); | |
45 | ||
46 | /** | |
47 | * depile le dernier element du vecteur. Si le vecteur est vide, ne | |
48 | * fait rien. | |
49 | */ | |
50 | public abstract IVecInt pop(); | |
51 | ||
52 | public abstract void growTo(int newsize, final int pad); | |
53 | ||
54 | public abstract void ensure(int nsize); | |
55 | ||
56 | public abstract IVecInt push(int elem); | |
57 | ||
58 | /** | |
59 | * Push the element in the Vector without verifying if there is room for it. | |
60 | * USE WITH CAUTION! | |
61 | * | |
62 | * @param elem | |
63 | */ | |
64 | void unsafePush(int elem); | |
65 | ||
66 | int unsafeGet(int eleem); | |
67 | ||
68 | public abstract void clear(); | |
69 | ||
70 | public abstract int last(); | |
71 | ||
72 | public abstract int get(int i); | |
73 | ||
74 | public abstract void set(int i, int o); | |
75 | ||
76 | public abstract boolean contains(int e); | |
77 | ||
78 | /** | |
79 | * C'est operations devraient se faire en temps constant. Ce n'est pas le | |
80 | * cas ici. | |
81 | * | |
82 | * @param copy | |
83 | */ | |
84 | public abstract void copyTo(IVecInt copy); | |
85 | ||
86 | /** | |
87 | * @param is | |
88 | */ | |
89 | public abstract void copyTo(int[] is); | |
90 | ||
91 | /* | |
92 | * Copie un vecteur dans un autre (en vidant le premier), en temps constant. | |
93 | */ | |
94 | public abstract void moveTo(IVecInt dest); | |
95 | ||
96 | public abstract void moveTo2(IVecInt dest); | |
97 | ||
98 | public abstract void moveTo(int[] dest); | |
99 | ||
100 | /** | |
101 | * Move elements inside the vector. The content of the method is equivalent | |
102 | * to: <code>vec[dest] = vec[source]</code> | |
103 | * | |
104 | * @param dest | |
105 | * the index of the destination | |
106 | * @param source | |
107 | * the index of the source | |
108 | */ | |
109 | void moveTo(int dest, int source); | |
110 | ||
111 | /** | |
112 | * Insert an element at the very begining of the vector. The former first | |
113 | * element is appended to the end of the vector in order to have a constant | |
114 | * time operation. | |
115 | * | |
116 | * @param elem | |
117 | * the element to put first in the vector. | |
118 | */ | |
119 | public abstract void insertFirst(final int elem); | |
120 | ||
121 | /** | |
122 | * Enleve un element qui se trouve dans le vecteur!!! | |
123 | * | |
124 | * @param elem | |
125 | * un element du vecteur | |
126 | */ | |
127 | public abstract void remove(int elem); | |
128 | ||
129 | /** | |
130 | * Delete the ith element of the vector. The latest element of the vector | |
131 | * replaces the removed element at the ith indexer. | |
132 | * | |
133 | * @param i | |
134 | * the indexer of the element in the vector | |
135 | * @return the former ith element of the vector that is now removed from the | |
136 | * vector | |
137 | */ | |
138 | public abstract int delete(int i); | |
139 | ||
140 | public abstract void sort(); | |
141 | ||
142 | public abstract void sortUnique(); | |
143 | ||
144 | /** | |
145 | * To know if a vector is empty | |
146 | * | |
147 | * @return true iff the vector is empty. | |
148 | * @since 1.6 | |
149 | */ | |
150 | boolean isEmpty(); | |
151 | } |
|