repositories
/
TP_POO.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
38098a5
)
TP2: Implement Image class as a Comparable<Image> interface.
author
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Mon, 5 Mar 2018 08:46:25 +0000
(09:46 +0100)
committer
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Mon, 5 Mar 2018 08:46:25 +0000
(09:46 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TP2/Image.java
patch
|
blob
|
blame
|
history
diff --git
a/TP2/Image.java
b/TP2/Image.java
index 8289930d309e5e9f9bb18b5014386ac55b5b4f1d..da903147207c2c4c4c9210bbe6699f0c4c36c052 100644
(file)
--- a/
TP2/Image.java
+++ b/
TP2/Image.java
@@
-1,5
+1,5
@@
-class Image extends Forme implements Compactable {
+class Image extends Forme implements Compactable
, Comparable<Image>
{
final int IMAGE_MAX_SIZE = 100;
Forme[] formeCollection;
int formeNumber;
@@
-16,6
+16,10
@@
class Image extends Forme implements Compactable {
formeNumber = 0;
}
+ public int getSize() {
+ return formeNumber;
+ }
+
private boolean isEmpty() {
return (formeNumber == 0);
}
@@
-80,4
+84,8
@@
class Image extends Forme implements Compactable {
}
}
+ public int compareTo(Image image) {
+ return formeNumber - image.getSize();
+ }
+
}