From a988a46e0446d611bf97c2c6b1288a1befd2d4a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 14 Feb 2018 12:16:02 +0100 Subject: [PATCH] Add the basic code for Image handling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- TP2/Image.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ TP2/Makefile | 1 + 2 files changed, 45 insertions(+) create mode 100644 TP2/Image.java diff --git a/TP2/Image.java b/TP2/Image.java new file mode 100644 index 0000000..807e11b --- /dev/null +++ b/TP2/Image.java @@ -0,0 +1,44 @@ + +class Image extends Forme { + final int IMAGE_MAX_SIZE = 100; + Point pOri; + Forme[] formeCollection; + int formeNumber; + + Image() { + pOri = new Point(); + formeCollection = new Forme[IMAGE_MAX_SIZE]; + formeNumber = 0; + } + + Image(Point p) { + pOri = p; + formeCollection = new Forme[IMAGE_MAX_SIZE]; + formeNumber = 0; + } + + private boolean isEmpty() { + return (formeNumber == 0); + } + + private boolean isFull() { + return (formeNumber >= formeCollection.length); + } + + public void dessiner(Piletransformations pile) { + for (int i = 0; i < formeNumber; i++) { + formeCollection[i].dessiner(pile); + } + } + + public void deplacer(Point p) { + for (int i = 0; i < formeNumber; i++) { + formeCollection[i].deplacer(p); + } + } + + public boolean ajouter(Forme forme) { + return false; + } + +} diff --git a/TP2/Makefile b/TP2/Makefile index 14f1b59..41023ff 100644 --- a/TP2/Makefile +++ b/TP2/Makefile @@ -48,6 +48,7 @@ JVM = java CLASSES = \ Point.java \ Forme.java \ + Image.java \ Segment.java \ Cercle.java \ Piletransformations.java \ -- 2.34.1