From 654aaff1272fde8e940f66981dd41733a6d39058 Mon Sep 17 00:00:00 2001 From: TheComputerGeek2 Date: Fri, 13 Mar 2015 12:47:38 -0700 Subject: [PATCH] More javadocs --- Pi-Day-Project/src/gui/RankingDisplay.java | 9 +----- Pi-Day-Project/src/main/Main.java | 34 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Pi-Day-Project/src/gui/RankingDisplay.java b/Pi-Day-Project/src/gui/RankingDisplay.java index 74c4dc5..26ebd51 100755 --- a/Pi-Day-Project/src/gui/RankingDisplay.java +++ b/Pi-Day-Project/src/gui/RankingDisplay.java @@ -1,7 +1,6 @@ package gui; import java.util.TreeMap; -import java.util.TreeSet; import javax.swing.JList; import javax.swing.JPanel; @@ -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()); } diff --git a/Pi-Day-Project/src/main/Main.java b/Pi-Day-Project/src/main/Main.java index d456c92..30736a5 100755 --- a/Pi-Day-Project/src/main/Main.java +++ b/Pi-Day-Project/src/main/Main.java @@ -30,21 +30,54 @@ public static void main(String[] args) { new UserInterface(); } + /** + * debugPrintln + *

+ * public static void debugPrintln({@link String} s) + *

+ * + * 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); } } + /** + * debugException + *

+ * public static void debugException({@link Exception} e) + *

+ * + * 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); } + /** + * getFile + *

+ * public static void getFile() + *

+ * + * 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 @@ -94,4 +127,5 @@ public static void fatalErrorNotification() { "Application will now shut down."); System.exit(1); } + }