Skip to content

Commit 9d3f15d

Browse files
committed
cleanup javadoc
1 parent 071a59a commit 9d3f15d

12 files changed

Lines changed: 26 additions & 96 deletions

File tree

src/main/java/org/teachingextensions/approvals/lite/util/NumberUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public static int load(String i, int defaultValue) {
2121

2222
/**
2323
* Loads an int from a String.
24+
*
25+
* @param i a string with an integer in it
26+
* @param defaultValue value to use when no integer can be found in the string
27+
* @param stripNonNumeric true if non-numeric characters should be removed from the string
28+
* @return the integer found in the string
2429
*/
2530
public static int load(String i, int defaultValue, boolean stripNonNumeric) {
2631
try {

src/main/java/org/teachingextensions/approvals/lite/util/ObjectUtils.java

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@
1010
* A static class of convenience functions for Manipulating objects
1111
*/
1212
public class ObjectUtils {
13-
public static Method[] getMethodsForObject(Object o2, String[] passedMethods)
14-
throws SecurityException, NoSuchMethodException {
15-
Method methods[] = new Method[passedMethods.length];
16-
Class clazz = o2.getClass();
17-
for (int i = 0; i < passedMethods.length; i++) {
18-
methods[i] = clazz.getMethod(passedMethods[i], (Class[]) null);
19-
}
20-
return methods;
21-
}
2213

2314
/**
2415
* A convenience function to check if two objects are equal.
@@ -28,18 +19,7 @@ public static Method[] getMethodsForObject(Object o2, String[] passedMethods)
2819
* @return true if Equal.
2920
*/
3021
public static boolean isEqual(Object s1, Object s2) {
31-
if (s1 == s2) {
32-
return true;
33-
} else return (s1 != null) && s1.equals(s2);
34-
}
35-
36-
public static boolean isIn(Object target, Object[] objects) {
37-
for (Object object : objects) {
38-
if (ObjectUtils.isEqual(object, target)) {
39-
return true;
40-
}
41-
}
42-
return false;
22+
return s1 == s2 || (s1 != null) && s1.equals(s2);
4323
}
4424

4525
public static boolean isThisInstanceOfThat(Class<?> thiz, Class<?> that) {
@@ -57,7 +37,9 @@ public static Error throwAsError(Throwable t) throws Error {
5737
}
5838

5939
/**
60-
* @deprecated use Query.select()
40+
* @param from the source array
41+
* @param methodName the filter method
42+
* @return a filtered array
6143
*/
6244
public static Object[] extractArray(Object[] from, String methodName) {
6345
try {
@@ -124,8 +106,8 @@ public static void assertInstance(Class classes[], Object object) {
124106
+ Arrays.asList(extractArray(classes, "getName"))
125107
+ " but was null");
126108
}
127-
for (int i = 0; i < classes.length; i++) {
128-
if (ClassUtils.getWrapperClass(classes[i]).isInstance(object)) {
109+
for (Class aClass : classes) {
110+
if (ClassUtils.getWrapperClass(aClass).isInstance(object)) {
129111
return;
130112
}
131113
}

src/main/java/org/teachingextensions/approvals/lite/util/StringUtils.java

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,10 @@
1111
public class StringUtils {
1212
public static final String NEW_LINE = System.getProperty("line.separator");
1313

14-
/**
15-
* *******************************************************************
16-
*/
17-
public static String loadNullableString(String i) {
18-
return StringUtils.isNonZero(i) ? i.trim() : null;
19-
}
20-
/***********************************************************************/
21-
22-
/**
23-
* *******************************************************************
24-
*/
2514
public static String stripWhiteSpace(String text) {
2615
return stripWhiteSpace(text, false);
2716
}
2817

29-
/**
30-
* *******************************************************************
31-
*/
3218
public static String padNumber(long number, int digits) {
3319
String text = "" + number;
3420
while (text.length() < digits) {
@@ -37,16 +23,10 @@ public static String padNumber(long number, int digits) {
3723
return text;
3824
}
3925

40-
/**
41-
* *******************************************************************
42-
*/
4326
public static String padNumber(int number, int digits) {
4427
return padNumber((long) number, digits);
4528
}
4629

47-
/**
48-
* *******************************************************************
49-
*/
5030
public static String stripWhiteSpace(String text, boolean all) {
5131
StringBuilder newText = new StringBuilder();
5232
boolean whitespace = false;
@@ -81,11 +61,7 @@ public static String stripWhiteSpace(String text, boolean all) {
8161
}
8262
return newText.toString();
8363
}
84-
/************************************************************************/
85-
/************************************************************************/
86-
/**
87-
* ********************************************************************
88-
*/
64+
8965
public static String stripNonNumeric(String number, boolean allowDecimal, boolean allowNegative) {
9066
boolean allowExponential = allowDecimal;
9167
boolean afterE = false;
@@ -136,7 +112,7 @@ public static String stripNonNumeric(String number, boolean allowDecimal, boolea
136112
}
137113
return result.toString();
138114
}
139-
/***********************************************************************/
115+
140116
/**
141117
* A convenience function to check that a String has at least 1 character.
142118
*
@@ -147,13 +123,10 @@ public static boolean isNonZero(String string) {
147123
return ((string != null) && string.trim().length() > 0);
148124
}
149125

150-
/**
151-
* *******************************************************************
152-
*/
153126
public static boolean isEmpty(String string) {
154127
return !isNonZero(string);
155128
}
156-
/************************************************************************/
129+
157130
/**
158131
* A convenience function to turn a vector of String objects into an Array
159132
* of the String objects.
@@ -181,9 +154,6 @@ public static String[] toArray(java.util.Collection<String> vectorOf) {
181154
return array;
182155
}
183156

184-
/**
185-
* *******************************************************************
186-
*/
187157
public static <T> String toString(String name, T[] array) {
188158
StringBuilder buffer = new StringBuilder();
189159
name = (name == null ? "array" : name);
@@ -198,9 +168,6 @@ public static <T> String toString(String name, T[] array) {
198168
return buffer.toString();
199169
}
200170

201-
/**
202-
* *******************************************************************
203-
*/
204171
public static <T> String toString(String name, Iterable<T> array) {
205172
StringBuilder buffer = new StringBuilder();
206173
name = (name == null ? "array" : name);
@@ -224,10 +191,6 @@ public static String arrayStringHelper(Object o) {
224191
return o.getClass().isArray() ? Arrays.toString((Object[]) o) : o.toString();
225192
}
226193

227-
/***********************************************************************/
228-
/**
229-
* *******************************************************************
230-
*/
231194
public static InputStream convertToInputStream(String string) {
232195
return new ByteArrayInputStream(string.getBytes());
233196
}

src/main/java/org/teachingextensions/approvals/lite/util/ThreadLauncher.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ public class ThreadLauncher implements Runnable {
1010
private Method method = null;
1111
private long delay;
1212

13-
/**
14-
* *******************************************************************
15-
*/
1613
public ThreadLauncher(Object object, Method method, Object[] objectParams, long delay) {
1714
this.delay = delay;
1815
this.object = object;
@@ -21,29 +18,15 @@ public ThreadLauncher(Object object, Method method, Object[] objectParams, long
2118
new Thread(this).start();
2219
}
2320

24-
/**
25-
* *******************************************************************
26-
*/
27-
public ThreadLauncher(Object object, String methodName) throws SecurityException, NoSuchMethodException {
28-
this(object, object.getClass().getMethod(methodName, (Class[]) null), null, 0);
29-
}
30-
31-
/**
32-
* *******************************************************************
33-
*/
3421
public void run() {
3522
try {
3623
Thread.sleep(delay);
37-
//My_System.event("Running " + method.getName());
3824
method.invoke(object, objectParams);
3925
} catch (Throwable t) {
4026
MySystem.warning("Caught throwable exception ", t);
4127
}
4228
}
43-
/***********************************************************************/
44-
/**
45-
* *******************************************************************
46-
*/
29+
4730
public static void launch(Action0 action) {
4831
new LambdaThreadLauncher(action);
4932
}

src/main/java/org/teachingextensions/approvals/lite/util/servlets/InvokerServlet.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,19 @@ public void init() throws ServletException {
6161
MySystem.variable("Mask", mask);
6262
}
6363

64-
/**
65-
* *******************************************************************
66-
*/
6764
public void destroy() {
6865
for (HttpServlet servlet : servlets.values()) {
6966
servlet.destroy();
7067
}
7168
super.destroy();
7269
}
7370

74-
/**
75-
* *******************************************************************
76-
*/
7771
public void serveRequest(HttpServletRequest request, HttpServletResponse response) throws IOException,
7872
ServletException {
7973
String pathInfo = request.getPathInfo();
8074
String servletClass = pathInfo.substring(1);
8175
int slash = servletClass.indexOf('/');
8276
if (slash >= 0) {
83-
// pathInfo = servletClass.substring(slash);
8477
servletClass = servletClass.substring(0, slash);
8578
}
8679

src/main/java/org/teachingextensions/logo/Pizza.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.ArrayList;
44

55
/**
6-
* <img src="https://cdn2.iconfinder.com/data/icons/fatcow/32x32/pizza.png" align="left" alt="A slice of pizza">
6+
* <img src="https://cdn2.iconfinder.com/data/icons/fatcow/32x32/pizza.png" style="text-align: left" alt="A slice of pizza">
77
* The Pizza allows you to make different sizes and kinds of pizza!
88
*/
99
public class Pizza {

src/main/java/org/teachingextensions/logo/Tortoise.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.teachingextensions.logo.utils.TortoiseUtils;
77

88
/**
9-
* <img src="https://lh5.googleusercontent.com/-B3Q59gpYW8o/T4tA2k_TYUI/AAAAAAAAAjo/WiqdoXjbkb0/s65/Tortoise.png" align="left" alt="A tortoise drawing a line" >
9+
* <img src="https://lh5.googleusercontent.com/-B3Q59gpYW8o/T4tA2k_TYUI/AAAAAAAAAjo/WiqdoXjbkb0/s65/Tortoise.png" style="text-align: left" alt="A tortoise drawing a line" >
1010
* The Tortoise allows you to draw lines and shapes by moving it around on the window
1111
*/
1212
public class Tortoise
@@ -91,6 +91,7 @@ public static void setPenWidth(Number width)
9191
* Gives you access to the window the
9292
* Tortoise is moving on so you can do things like change it's color. <br>
9393
* <b>Example:</b> {@code TurtlePanel panel = Tortoise.getBackgroundWindow()}
94+
* @return the window that the Tortoise is moving on
9495
*/
9596
public static TurtlePanel getBackgroundWindow()
9697
{
@@ -177,7 +178,8 @@ public static double getAngle()
177178
/**
178179
* Changes the type of animal you are using. <br>
179180
* <div><b>Example:</b> {@code Tortoise.setAnimal(Animals.Spider);}</div>
180-
*
181+
*
182+
* @param animal the animal you want to use
181183
* @see Animals
182184
*/
183185
public static void setAnimal(Animals animal)

src/main/java/org/teachingextensions/logo/shapes/Circle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.teachingextensions.windows.ProgramWindow;
1111

1212
/**
13-
* <img src="http://www2.psd100.com/ppp/2013/11/2701/Blue-circle-1127210229.png" align="left" alt="A blue circle" >
13+
* <img src="http://www2.psd100.com/ppp/2013/11/2701/Blue-circle-1127210229.png" style="text-align: left" alt="A blue circle" >
1414
* The Circle allows you to draw circles on the window
1515
*/
1616
public class Circle implements Paintable

src/main/java/org/teachingextensions/logo/shapes/Text.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.teachingextensions.logo.TurtlePanel;
1111

1212
/**
13-
* <img src="http://www.iconeasy.com/icon/thumbnails/System/BlankOn/Text%20Icon.jpg" align="left" alt="A sheet of paper with text on it">
13+
* <img src="http://www.iconeasy.com/icon/thumbnails/System/BlankOn/Text%20Icon.jpg" style="text-align: left" alt="A sheet of paper with text on it">
1414
* Text allows you to write text on the window
1515
*/
1616
public class Text implements Paintable
@@ -31,6 +31,7 @@ public Text(String string)
3131
* the X position
3232
* @param y
3333
* the Y position
34+
* @return the same Text that you are working with
3435
*/
3536
public Text setTopLeft(int x, int y)
3637
{

src/main/java/org/teachingextensions/logo/utils/Sounds.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.awt.Toolkit;
44

55
/**
6-
* <img src="http://www.spellzone.com/images/sound-icon.gif" align="left" alt="A speaker with sound waves" >
6+
* <img src="http://www.spellzone.com/images/sound-icon.gif" style="text-align: left" alt="A speaker with sound waves" >
77
* Sounds allows you to play sounds, like a 'beep'
88
*/
99
public class Sounds

0 commit comments

Comments
 (0)