Skip to content

Commit

Permalink
More javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
TheComputerGeek2 committed Mar 13, 2015
1 parent 74b994e commit 654aaff
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
9 changes: 1 addition & 8 deletions Pi-Day-Project/src/gui/RankingDisplay.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package gui;

import java.util.TreeMap;
import java.util.TreeSet;

import javax.swing.JList;
import javax.swing.JPanel;
Expand Down Expand Up @@ -41,17 +40,11 @@ public void addAttempt(UserAttempt newAttempt) {
updateDisplay();
}

private String getAttemptLabel(UserAttempt attempt) {
private static String getAttemptLabel(UserAttempt attempt) {
String label = attempt.getUsername() + " - " + attempt.getDigitsCorrect();
return label;
}



//public void updateUser(String username, int digits) {
// TODO make this work
//}

private void updateDisplay() {
listings.setListData(attempts.values().toArray());
}
Expand Down
34 changes: 34 additions & 0 deletions Pi-Day-Project/src/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,54 @@ public static void main(String[] args) {
new UserInterface();
}

/**
* <strong>debugPrintln</strong>
* <p>
* public static void <strong>debugPrintln</strong>({@link String} s)
* <p>
*
* Writes s to the debug PrintStream, if the debug mode has been enabled.
*
* @param s
* the value to write to the debug stream.
*/
public static void debugPrintln(String s) {
if (DEBUG) {
debugOut.println(s);
}
}

/**
* <strong>debugException</strong>
* <p>
* public static void <strong>debugException</strong>({@link Exception} e)
* <p>
*
* Writes e's stack trace to the debug PrintStream.
*
* @param e
* the Exception to write to the debug stream.
*/
public static void debugException(Exception e) {
e.printStackTrace(debugOut);
}

/**
* <strong>getFile</strong>
* <p>
* public static void <strong>getFile</strong>()
* <p>
*
* Ensures that there is a file with the digits of Pi that the application
* may read from. Downloads the file if it isn't found locally.
*
*/
public static void getFile() {
try {

File piData = new File(piFileName);
if (!piData.exists()) {

URL website = new URL(
"https://dl.dropboxusercontent.com/u/44791770/Pi.txt");
ReadableByteChannel rbc = Channels.newChannel(website
Expand Down Expand Up @@ -94,4 +127,5 @@ public static void fatalErrorNotification() {
"Application will now shut down.");
System.exit(1);
}

}

0 comments on commit 654aaff

Please sign in to comment.