Author: ks156
Date: 2009-10-14 09:39:09 +0200 (Wed, 14 Oct 2009)
New Revision: 5646

Modified:
   
software_suite_v3/software/plugin/plugin-clock/branches/random_sentences/sources/net/karmaLab/tuxDroid/plugins/ClockPlugin.java
Log:
* Retab
* Removed trailing spaces
* Recoded with the std java style
* Renamed pickUpWeatherSentence to pickupSentence


Modified: 
software_suite_v3/software/plugin/plugin-clock/branches/random_sentences/sources/net/karmaLab/tuxDroid/plugins/ClockPlugin.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-clock/branches/random_sentences/sources/net/karmaLab/tuxDroid/plugins/ClockPlugin.java
     2009-10-14 07:31:02 UTC (rev 5645)
+++ 
software_suite_v3/software/plugin/plugin-clock/branches/random_sentences/sources/net/karmaLab/tuxDroid/plugins/ClockPlugin.java
     2009-10-14 07:39:09 UTC (rev 5646)
@@ -32,94 +32,98 @@
 
 public class ClockPlugin extends SimplePlugin<SimplePluginConfiguration> {
 
-       /**
-        * Main gadget access point.
-        *
-        * @param args
-        *            commands
-        * @throws Exception
-        *             errors
-        */
-       
-       String[] normalSentences = {
-                                       "Current time is {0} hours and {1} 
minutes.", 
-                                       "At the next top, it will be exactly 
{0} hours {1} ... TOP !",
-                                       "It's {1} hours and {0} minutes ... 
oops, {0} hours and {1} minutes"
-                                                       }; 
-       String[] sharpSentences = {
-                                       "Current time is {0} o'clock", 
-                                       "At the next top, it will be exactly 
{0} o'clock ... TOP !",                            
-                                                       };
-       
-       public static void main(String[] args) throws Exception {
-               new ClockPlugin().boot(args, new SimplePluginConfiguration());
-       }
+    /**
+     * Main gadget access point.
+     *
+     * @param args
+     *            commands
+     * @throws Exception
+     *             errors
+     */
 
-       private final Calendar calendar = new GregorianCalendar();
+    String[] normalSentences = {
+        "Current time is {0} hours and {1} minutes.",
+        "At the next top, it will be exactly {0} hours {1} ... TOP !",
+        "It's {1} hours and {0} minutes ... oops, {0} hours and {1} minutes"
+    };
+    String[] sharpSentences = {
+        "Current time is {0} o'clock",
+        "At the next top, it will be exactly {0} o'clock ... TOP !",
+    };
 
-       @Override
-       public void start() {
-               if (getCommand().equals("run")) {
-                       run();
-               }
-               else {
-                       run();
-               }
-       }
+    public static void main(String[] args) throws Exception {
+        new ClockPlugin().boot(args, new SimplePluginConfiguration());
+    }
 
-       private void run() {
-               calendar.setTime(new Date());
-               int h = calendar.get(Calendar.HOUR_OF_DAY);
-               int m = calendar.get(Calendar.MINUTE);
-               
-               Random rand = new Random();
-               Boolean random = rand.nextBoolean();
-               
-               if (m == 0) 
-               {
-                        if (h == 0)
-                            throwMessage("It's midnight");
-                        else if (h == 12)
-                            throwMessage("It's noon");
-                        else
-                           
throwMessage(this.pickUpWeatherSentence(sharpSentences), h);
-               } 
-               else if (m == 15)
-               {
-                       if (random)
-                               throwMessage("It's quarter past {0}", h);
-                       else
-                               
throwMessage(this.pickUpWeatherSentence(normalSentences), h, m);
-               }
-               else if (m == 30)
-               {
-                       if (random)
-                               throwMessage("It's half past {0}", h);
-                       else
-                               
throwMessage(this.pickUpWeatherSentence(normalSentences), h, m);
-               }
-               else if (m == 45)
-               {
-                       if (random)
-                               throwMessage("It's quarter to {0}", (h + 1));
-                       else
-                               
throwMessage(this.pickUpWeatherSentence(normalSentences), h, m);
-               }
-               else 
-               {
-                       
throwMessage(this.pickUpWeatherSentence(normalSentences), h, m);
-               }
-       }
-       
-       private String pickUpWeatherSentence(String[] list) {
-               Random rand = new Random();
-               return list[rand.nextInt(list.length)];
-       }
+    private final Calendar calendar = new GregorianCalendar();
 
     @Override
+        public void start() {
+            if (getCommand().equals("run")) {
+                run();
+            }
+            else {
+                run();
+            }
+        }
+
+    private void run() {
+        calendar.setTime(new Date());
+        int h = calendar.get(Calendar.HOUR_OF_DAY);
+        int m = calendar.get(Calendar.MINUTE);
+
+        Random rand = new Random();
+        Boolean random = rand.nextBoolean();
+
+        if (m == 0) {
+            if (h == 0) {
+                throwMessage("It's midnight");
+            }
+            else if (h == 12) {
+                throwMessage("It's noon");
+            }
+            else {
+                throwMessage(this.pickupSentence(sharpSentences), h);
+            }
+        }
+        else if (m == 15) {
+            if (random) {
+                throwMessage("It's quarter past {0}", h);
+            }
+            else {
+                throwMessage(this.pickupSentence(normalSentences), h, m);
+            }
+        }
+        else if (m == 30) {
+            if (random) {
+                throwMessage("It's half past {0}", h);
+            }
+            else {
+                throwMessage(this.pickupSentence(normalSentences), h, m);
+            }
+        }
+        else if (m == 45) {
+            if (random) {
+                throwMessage("It's quarter to {0}", (h + 1));
+            }
+            else {
+                throwMessage(this.pickupSentence(normalSentences), h, m);
+            }
+        }
+        else {
+            throwMessage(this.pickupSentence(normalSentences), h, m);
+        }
+    }
+
+    private String pickupSentence(String[] list) {
+        Random rand = new Random();
+        return list[rand.nextInt(list.length)];
+    }
+
+    @Override
     public void onPluginStop() {
     }
-    
+
     @Override
     public void onPluginEvent(String eventName, String[] eventValues) {
     }


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to