From aadcaadeb4106f40583b9e94fb299d23c97f7089 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 15 Sep 2011 15:04:39 +0100 Subject: More docs and the start of a readme. --- .../src/uk/ac/open/punchingbag/PunchingBag.java | 135 +++++++++++++++++++-- 1 file changed, 122 insertions(+), 13 deletions(-) (limited to 'PunchingBag') diff --git a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java index b597cbc..70da436 100644 --- a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java +++ b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java @@ -25,6 +25,86 @@ import java.util.Iterator; * @author Christopher Baines * @author Adam Martindale */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ +/** + * @author cb24367 + * + */ public class PunchingBag implements Runnable { /** * Used by the run method to decide if to call the LEDListeners @@ -202,12 +282,15 @@ public class PunchingBag implements Runnable { } /** - * Used by methods in the PunchingBag class to change the led's array. To simplify things it will accept any Color object, - * but if it's not one of the supported (red,green,yellow), then it will just set it to white (the none colour). + * Used by methods in the PunchingBag class to change the led's array. To simplify things it will accept any Color + * object, but if it's not one of the supported (red,green,yellow), then it will just set it to white (the none colour). * - * @param x The x coordinate of the led - * @param y The y coordinate of the led - * @param colour The desired colour of the led, as either Color.red, Color.yellow, Color.green or Color,white. + * @param x + * The x coordinate of the led + * @param y + * The y coordinate of the led + * @param colour + * The desired colour of the led, as either Color.red, Color.yellow, Color.green or Color,white. * @return true if something was changed, false if not */ private boolean setLEDInternal(int x, int y, Color colour) { @@ -232,7 +315,8 @@ public class PunchingBag implements Runnable { } /** - * Sets a LED on the grid to the specified colour, either use + * Sets a LED on the grid to the specified colour, either use this command again to change it, or use the + * clearLEDS() function to clear the entire grid. * * @param x * @param y @@ -242,14 +326,39 @@ public class PunchingBag implements Runnable { runningEffects.add(new Point(x, y, colour)); } + /** + * Starts an expanding circle at x and y. + * + * @param x The x coordinate of the centre of the circle. + * @param y The y coordinate of the centre of the circle. + * @param intensity This controls the intensity of the circle, including colour and (but not yet) weight. + */ public void circleExpand(int x, int y, int intensity) { runningEffects.add(new CircleExpand(x, y, 100)); } + /** + * This controls the intensity of the circle, including colour and (but not yet) weight. + * + * @param x The x coordinate of the centre of the square + * @param y The y coordinate of the centre of the square + * @param intensity AFAIK, this does nothing yet + * @param colour The colour of the square + */ public void squareExpand(int x, int y, int intensity, Color colour) { runningEffects.add(new SquareExpand(x, y, intensity, colour)); } - + + /** + * This should fill in a rectangle + * + * @param x The x coordinate of the top right of the rectangle + * @param y The y coordinate of the top right of the + * @param width + * @param height + * @param colour + * @param time + */ public void fillRect(int x, int y, int width, int height, Color colour, long time) { runningEffects.add(new FillRect(x, y, width, height, colour, time)); } @@ -894,13 +1003,13 @@ public class PunchingBag implements Runnable { System.out.println("Button: " + (System.currentTimeMillis() - beginTimeButtonIn)); calculateRawLeds(); - //String str; - //for (int i = 0; i < (6 * 8); i++) { - // printByte(rawLeds[i]); - //} - //System.out.println(""); + // String str; + // for (int i = 0; i < (6 * 8); i++) { + // printByte(rawLeds[i]); + // } + // System.out.println(""); - //Arrays.fill(rawLeds, (byte) -42); + // Arrays.fill(rawLeds, (byte) -42); long beginTimeLedOut = System.currentTimeMillis(); if (ledArduino.out != null) { // calculateRawLeds(); -- cgit v1.2.3