repositories
/
TP_POO.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix the Compactable implementation in Entiers and Listes classes.
[TP_POO.git]
/
TP2
/
Entiers.java
diff --git
a/TP2/Entiers.java
b/TP2/Entiers.java
index a1e18b64911ed78cc45b4dcf8bcdc6ef348b9870..b690d10426728590f0efa8365a448f1cd531baa6 100644
(file)
--- a/
TP2/Entiers.java
+++ b/
TP2/Entiers.java
@@
-75,7
+75,6
@@
class Entiers extends Structure {
System.out.println("Aucune valeur à supprimer");
return false;
}
System.out.println("Aucune valeur à supprimer");
return false;
}
-
for (int i = 0; i < getCurrentSize(); i++) {
if (int_array[i] == value) {
// Deleting the element in the tab
for (int i = 0; i < getCurrentSize(); i++) {
if (int_array[i] == value) {
// Deleting the element in the tab
@@
-106,7
+105,12
@@
class Entiers extends Structure {
}
public void compacter(int nElements) {
}
public void compacter(int nElements) {
-
+ if (current_size - nElements > 0) {
+ // Remove the last nElements
+ current_size -= nElements;
+ } else {
+ current_size = 0;
+ }
}
}
}
}