repositories
/
TP_POO.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Code cleanup : fix C style array declaration.
[TP_POO.git]
/
TP2
/
Entiers.java
diff --git
a/TP2/Entiers.java
b/TP2/Entiers.java
index 80fcc9016434b0b5ec16c3f946c1999e37097fa3..6c840df0607600197d7e1d5a8494108ac8a483fe 100644
(file)
--- a/
TP2/Entiers.java
+++ b/
TP2/Entiers.java
@@
-1,6
+1,10
@@
+@ClassPreamble (
+ author = "Jérôme Benoit",
+ date = "05/03/2009"
+)
class Entiers extends Structure {
class Entiers extends Structure {
- private int
int_array[]
;
+ private int
[] int_array
;
private int array_size;
private int current_size;
private int array_size;
private int current_size;
@@
-67,7
+71,7
@@
class Entiers extends Structure {
return middle;
else if (value > int_array[middle])
return binarySearch((middle + 1), last, value);
return middle;
else if (value > int_array[middle])
return binarySearch((middle + 1), last, value);
- return binarySearch(first, (middle -1), value);
+ return binarySearch(first, (middle -
1), value);
}
public boolean supprimer(int value) {
}
public boolean supprimer(int value) {
@@
-75,7
+79,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
@@
-105,4
+108,12
@@
class Entiers extends Structure {
}
}
}
}
+ public void compacter(int nElements) {
+ if (current_size - nElements > 0) {
+ // Remove the last nElements
+ current_size -= nElements;
+ } else {
+ current_size = 0;
+ }
+ }
}
}