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.
[TP_POO.git]
/
Piles
/
Pile.java
diff --git
a/Piles/Pile.java
b/Piles/Pile.java
index 915a63c168bcf248dc2023424c34064f7042031d..5d309d16ab415dbc51092813e85c54ddb56a7d66 100644
(file)
--- a/
Piles/Pile.java
+++ b/
Piles/Pile.java
@@
-2,51
+2,51
@@
/**
*
*/
/**
*
*/
-class Pile {
- private int
int_array[]
;
+
public
class Pile {
+ private int
[] int_array
;
private int array_size;
private int array_size;
- private int
stack_
head_index;
+ private int head_index;
/**
/**
- * [
setSiz
e description]
+ * [
Pil
e description]
* @param int size [description]
*/
* @param int size [description]
*/
+ Pile(int size) {
+ int_array = new int[size];
+ setSize(size);
+ setHeadIndex(0);
+ }
+
+ /**
+ * set the size of the internal array
+ * @param int size the size of the array
+ */
private void setSize(int size) {
array_size = size;
}
/**
private void setSize(int size) {
array_size = size;
}
/**
- *
[getSize description]
- * @return
[description]
+ *
get the size of the internal array
+ * @return
the integer size of the internal array
*/
private int getSize() {
return array_size;
}
/**
*/
private int getSize() {
return array_size;
}
/**
- *
[setHeadIndex description]
- * @param int index
[description]
+ *
set the stack head index
+ * @param int index
the stack head index
*/
private void setHeadIndex(int index) {
*/
private void setHeadIndex(int index) {
-
stack_
head_index = index;
+ head_index = index;
}
/**
}
/**
- *
[getHeadIndex description]
- * @return
[description]
+ *
get the stack head current index
+ * @return
the integer stack head index
*/
private int getHeadIndex() {
*/
private int getHeadIndex() {
- return stack_head_index;
- }
-
- /**
- * [Pile description]
- * @param int size [description]
- */
- Pile(int size) {
- int_array = new int[size];
- setSize(size);
- setHeadIndex(0);
+ return head_index;
}
/**
}
/**
@@
-55,8
+55,8
@@
class Pile {
*/
public void empiler(int value) {
if (!plein()) {
*/
public void empiler(int value) {
if (!plein()) {
- int_array[
stack_
head_index] = value;
-
stack_
head_index++;
+ int_array[head_index] = value;
+ head_index++;
} else {
System.out.println("La pile est pleine");
}
} else {
System.out.println("La pile est pleine");
}
@@
-68,8
+68,8
@@
class Pile {
*/
public int depiler() {
if (!vide()) {
*/
public int depiler() {
if (!vide()) {
-
stack_
head_index--;
- return int_array[
stack_
head_index];
+ head_index--;
+ return int_array[head_index];
} else {
return -1;
}
} else {
return -1;
}
@@
-95,7
+95,7
@@
class Pile {
* [afficher description]
*/
public void afficher() {
* [afficher description]
*/
public void afficher() {
- for (int i = 0; i < get
Size
(); i++) {
+ for (int i = 0; i < get
HeadIndex
(); i++) {
System.out.println("element " + i + " " + int_array[i]);
}
}
System.out.println("element " + i + " " + int_array[i]);
}
}