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:
1ace873
)
TP2: Implement the Image class as a Comparator<Image> interface.
author
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Mon, 5 Mar 2018 09:10:50 +0000
(10:10 +0100)
committer
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Mon, 5 Mar 2018 09:10:50 +0000
(10:10 +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 da903147207c2c4c4c9210bbe6699f0c4c36c052..d508e75d4fc647d58f38bfa97432a46c8d29c4ff 100644
(file)
--- a/
TP2/Image.java
+++ b/
TP2/Image.java
@@
-1,5
+1,6
@@
+import java.util.Comparator;
-
class Image extends Forme implements Compactable, Comparable
<Image> {
+
public class Image extends Forme implements Compactable, Comparable<Image>, Comparator
<Image> {
final int IMAGE_MAX_SIZE = 100;
Forme[] formeCollection;
int formeNumber;
@@
-88,4
+89,8
@@
class Image extends Forme implements Compactable, Comparable<Image> {
return formeNumber - image.getSize();
}
+ public int compare(Image image1, Image image2) {
+ return image1.getSize() - image2.getSize();
+ }
+
}