Skip to content

Commit 21f71af

Browse files
committed
Cleanup
Prepare for release.
1 parent 75906c8 commit 21f71af

14 files changed

Lines changed: 53 additions & 64 deletions

File tree

TouchControl/src/io/github/mattson543/touchcontrol/demo/TouchController.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ private void start()
4444
displayFatalError("Failed to load OpenCV!");
4545

4646
//Force exit
47-
System.out.print("Program terminated.");
4847
System.exit(0);
4948
}
5049

50+
@SuppressWarnings("unused")
5151
private void capture(boolean debugMode)
5252
{
5353
//Start camera
@@ -61,8 +61,7 @@ private void capture(boolean debugMode)
6161
}
6262

6363
//Get camera properties
64-
double cameraWidth = camera.getWidth();
65-
double cameraHeight = camera.getHeight();
64+
double cameraWidth = camera.getWidth(), cameraHeight = camera.getHeight();
6665

6766
//Create display
6867
ImageFrame rawDisplay = new ImageFrame("Touch Control");

TouchControl/src/io/github/mattson543/touchcontrol/display/ImageFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import javax.swing.JFrame;
77

88
/**
9-
* Frame - GUI container for components (holds ImagePanel)
9+
* Frame - GUI container for components (holds ImagePanel).
1010
*
1111
* @author mattson543
1212
*/

TouchControl/src/io/github/mattson543/touchcontrol/display/ImagePanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import javax.swing.JPanel;
77

88
/**
9-
* Panel - holds image to display in GUI
9+
* Panel - holds image to display in GUI.
1010
*
1111
* @author mattson543
1212
*/

TouchControl/src/io/github/mattson543/touchcontrol/touchables/Button.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.opencv.core.*;
44

55
/**
6-
* Abstract Button - contains general (clickable) button behavior
6+
* Abstract Button - contains general (clickable) button behavior.
77
*
88
* @author mattson543
99
*/
@@ -22,8 +22,8 @@ protected Button(Rect dimensions, Scalar color)
2222

2323
/*
2424
* (non-Javadoc)
25-
* @see io.github.mattson543.touchcontrol.touchables.Touchable#
26-
* updateDetectionPoint(org.opencv.core.Mat)
25+
* @see io.github.mattson543.touchcontrol.touchables.Touchable
26+
* #updateDetectionPoint(org.opencv.core.Mat)
2727
*/
2828
@Override
2929
public Point updateDetectionPoint(Mat filteredImage)

TouchControl/src/io/github/mattson543/touchcontrol/touchables/MousePad.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import org.opencv.core.Point;
77

88
/**
9-
* Demo Pad - Example application of abstract pad
10-
* Controls mouse pointer position
9+
* Demo Pad - Example application of abstract pad.
10+
* Controls mouse pointer position.
1111
*
1212
* @author mattson543
1313
*/
@@ -28,7 +28,7 @@ public MousePad(Rect dimensions, Scalar color)
2828
}
2929

3030
/**
31-
* Initialize fields
31+
* Initialize fields.
3232
*/
3333
private void init()
3434
{
@@ -62,7 +62,7 @@ public void performAction()
6262

6363
/**
6464
* Convert the internal detection point from a point on the Touchable to a
65-
* point on the screen so the mouse can be moved anywhere on the display
65+
* point on the screen so the mouse can be moved anywhere on the display.
6666
*
6767
* @return Adjusted point
6868
*/

TouchControl/src/io/github/mattson543/touchcontrol/touchables/Pad.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.opencv.core.*;
44

55
/**
6-
* Abstract Pad - contains general pad behavior
6+
* Abstract Pad - contains general pad behavior.
77
*
88
* @author mattson543
99
*/

TouchControl/src/io/github/mattson543/touchcontrol/touchables/PianoKey.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import org.opencv.core.*;
66

77
/**
8-
* Demo Button - Example application of abstract button
9-
* Plays note when touched
8+
* Demo Button - Example application of abstract button.
9+
* Plays note when touched.
1010
*
1111
* @author mattson543
1212
*/
@@ -32,7 +32,7 @@ public PianoKey(Rect dimensions, Scalar color, char note)
3232
}
3333

3434
/**
35-
* Initialize fields
35+
* Initialize fields.
3636
*
3737
* @param note
3838
* Character representation of the note
@@ -47,7 +47,7 @@ private void init(char note)
4747
}
4848

4949
/**
50-
* Determine the key of the note based on the character input
50+
* Determine the key of the note based on the character input.
5151
*
5252
* @param note
5353
* Character representation of the note
@@ -65,7 +65,7 @@ private int determineKey(char note)
6565
}
6666

6767
/**
68-
* Create the audio player
68+
* Create the audio player.
6969
*/
7070
private void setupMidi()
7171
{
@@ -99,7 +99,6 @@ public void performAction()
9999
if (!hasPlayed)
100100
{
101101
playNote(1000);
102-
103102
hasPlayed = true;
104103
}
105104
}
@@ -108,7 +107,7 @@ public void performAction()
108107
}
109108

110109
/**
111-
* Play the note that was assigned to the key
110+
* Play the note that was assigned to the key.
112111
*
113112
* @param duration
114113
* The amount of ms that the note should be held for

TouchControl/src/io/github/mattson543/touchcontrol/touchables/Slider.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import org.opencv.imgproc.Imgproc;
55

66
/**
7-
* Abstract Slider - contains general slider behavior
7+
* Abstract Slider - contains general slider behavior.
88
*
99
* @author mattson543
1010
*/
@@ -27,8 +27,8 @@ public abstract class Slider extends Touchable
2727
*/
2828
private boolean shouldLabel;
2929

30-
private static int DEFAULT_DIVISIONS = 100;
31-
private static boolean DEFAULT_VISIBILITY = true;
30+
private static final int DEFAULT_DIVISIONS = 100;
31+
private static final boolean DEFAULT_VISIBILITY = true;
3232

3333
protected Slider(Rect dimensions, Scalar color)
3434
{
@@ -63,7 +63,7 @@ protected boolean isLabeled()
6363
}
6464

6565
/**
66-
* Determine the size of each division sector
66+
* Determine the size of each division sector.
6767
*/
6868
private void calculateDivisionSize()
6969
{
@@ -72,7 +72,7 @@ private void calculateDivisionSize()
7272
}
7373

7474
/**
75-
* Confine number of divisions to range
75+
* Confine number of divisions to range.
7676
*
7777
* @param divisions
7878
* Attempted value
@@ -90,8 +90,8 @@ else if (divisions > 100)
9090

9191
/*
9292
* (non-Javadoc)
93-
* @see io.github.mattson543.touchcontrol.touchables.Touchable#
94-
* updateDetectionPoint(org.opencv.core.Mat)
93+
* @see io.github.mattson543.touchcontrol.touchables.Touchable
94+
* #updateDetectionPoint(org.opencv.core.Mat)
9595
*/
9696
@Override
9797
public Point updateDetectionPoint(Mat filteredImage)
@@ -107,8 +107,8 @@ public Point updateDetectionPoint(Mat filteredImage)
107107

108108
/*
109109
* (non-Javadoc)
110-
* @see io.github.mattson543.touchcontrol.touchables.Touchable#drawOnto(org.
111-
* opencv.core.Mat)
110+
* @see io.github.mattson543.touchcontrol.touchables.Touchable
111+
* #drawOnto(org.opencv.core.Mat)
112112
*/
113113
@Override
114114
public void drawOnto(Mat image)
@@ -119,7 +119,7 @@ public void drawOnto(Mat image)
119119
}
120120

121121
/**
122-
* Draw status line and label
122+
* Draw status line and label.
123123
*
124124
* @param image
125125
* Matrix

TouchControl/src/io/github/mattson543/touchcontrol/touchables/ToggleButton.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.opencv.core.*;
44

55
/**
6-
* Abstract Button - contains general (toggle) button behavior
6+
* Abstract Button - contains general (toggle) button behavior.
77
*
88
* @author mattson543
99
*/
@@ -28,8 +28,8 @@ protected ToggleButton(Rect dimensions, Scalar color)
2828
/*
2929
* (non-Javadoc)
3030
* @see
31-
* io.github.mattson543.touchcontrol.touchables.Button#updateDetectionPoint(
32-
* org.opencv.core.Mat)
31+
* io.github.mattson543.touchcontrol.touchables.Button
32+
* #updateDetectionPoint(org.opencv.core.Mat)
3333
*/
3434
@Override
3535
public Point updateDetectionPoint(Mat filteredImage)

TouchControl/src/io/github/mattson543/touchcontrol/touchables/Touchable.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import org.opencv.imgproc.Imgproc;
55

66
/**
7-
* Contains fundamental functions for a Touchable object of any kind
7+
* Contains fundamental functions for a Touchable object of any kind.
88
*
99
* @author mattson543
1010
*/
@@ -52,7 +52,7 @@ public Scalar getColor()
5252

5353
/**
5454
* Search through the range of the Touchable and find the first occurrence
55-
* of a non-background pixel
55+
* of a non-background pixel.
5656
*
5757
* @param filteredImage
5858
* Binary image
@@ -95,7 +95,7 @@ public Point updateDetectionPoint(Mat filteredImage)
9595
}
9696

9797
/**
98-
* Determine whether or not the current detection point is null
98+
* Determine whether or not the current detection point is null.
9999
*
100100
* @return Detection status
101101
*/
@@ -105,7 +105,7 @@ protected boolean hasDetection()
105105
}
106106

107107
/**
108-
* Draw Touchable onto image
108+
* Draw Touchable onto image.
109109
*
110110
* @param image
111111
* Matrix to draw the Touchable object onto
@@ -124,12 +124,12 @@ public void drawOnto(Mat image)
124124
}
125125

126126
/**
127-
* Enforce method requirement on subclasses
127+
* Abstract action that each Touchable subclass will perform.
128128
*/
129129
public abstract void performAction();
130130

131131
/**
132-
* Formatter to create a uniform toString() for all Touchable objects
132+
* Formatter to create a uniform toString() for all Touchable objects.
133133
*
134134
* @param name
135135
* Name of field being formatted

0 commit comments

Comments
 (0)