From 6a44b074f0169a1b0f9e92347af929c5e471746e Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sat, 18 Apr 2015 13:44:44 +0200 Subject: Reorganised projects --- Week4 Drawing loipes/src/oo15loipe/Punt.java | 73 ++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Week4 Drawing loipes/src/oo15loipe/Punt.java (limited to 'Week4 Drawing loipes/src/oo15loipe/Punt.java') diff --git a/Week4 Drawing loipes/src/oo15loipe/Punt.java b/Week4 Drawing loipes/src/oo15loipe/Punt.java new file mode 100644 index 0000000..2c94f1f --- /dev/null +++ b/Week4 Drawing loipes/src/oo15loipe/Punt.java @@ -0,0 +1,73 @@ +package oo15loipe; + +/** + * Een Punt in 2D + * @author pieter koopman + */ + +public class Punt { + private int x, y; + + /** + * de gewone constructor + * @param i: x + * @param j; y + */ + public Punt(int i, int j) { + x = i; + y = j; + } + + /** + * copy constructor + * @param p + */ + public Punt (Punt p) { + if (p != null) { + x = p.x; + y = p.y; + } else { + x = y = 0; + } + } + + /** + * getter voor x + * @return x + */ + public int getX (){ + return x; + } + + /** + * getter voor y + * @return y + */ + public int getY (){ + return y; + } + + /** + * equals methode vergelijkt x en y + * @param o + * @return + */ + @Override + public boolean equals(Object o) { + if (o != null && o instanceof Punt) { + Punt p = (Punt) o; + return x == p.x && y == p.y; + } else { + return false; + } + } + + /** + * Punt naar String conversie + * @return Strin met waarde van x en y + */ + @Override + public String toString () { + return "(" + x + "," + y + ")"; + } +} -- cgit v1.2.3