[Swift-commit] r4686 - usertools/plotter/src/plotter

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Thu Jun 23 19:39:18 CDT 2011


Author: jonmon
Date: 2011-06-23 19:39:18 -0500 (Thu, 23 Jun 2011)
New Revision: 4686

Modified:
   usertools/plotter/src/plotter/Plotter.java
Log:
o switched to using the gnu.getopt.Getopt class to choose between plot types.


Modified: usertools/plotter/src/plotter/Plotter.java
===================================================================
--- usertools/plotter/src/plotter/Plotter.java	2011-06-24 00:16:58 UTC (rev 4685)
+++ usertools/plotter/src/plotter/Plotter.java	2011-06-24 00:39:18 UTC (rev 4686)
@@ -4,10 +4,13 @@
 import plotter.Lines;
 import plotter.Dual;
 
+import gnu.getopt.Getopt;
+
 public class Plotter
 {
     public static void main(String[] args)
     {
+    	Getopt plot = new Getopt( "Plotter", args, "sdh");
     	/* 
     	 * Fix this check: Need to check to see if the specify one of the types of plots first
     	 * then check to see if the argument counts is correct.
@@ -23,24 +26,28 @@
         {
             tmp[i] = args[i+1];
         }
-
-        /* If asking for a single labeled Y-axis */
-        if (args[0].equalsIgnoreCase( "-s" ))
+        switch( plot.getopt() )
         {
-            Lines l = new Lines();
-            l.plotter(tmp);
+        	/* If asking for a single labeled Y-axis */
+        	case 's':
+        	{
+        		Lines l = new Lines();
+        		l.plotter( tmp );
+        		break;
+        	}
+        	/* If asking for a dual labeled Y-axis */
+        	case 'd':
+        	{
+        		Dual d = new Dual();
+        		d.plotter( tmp );
+        		break;
+        	}
+        	/* Do not understand option for what graph */
+        	default:
+        	{
+        		usage();
+        	}
         }
-        /* If asking for a dual labeled Y-axis */
-        else if (args[0].equalsIgnoreCase( "-d" ))
-        {
-            Dual d = new Dual();
-            d.plotter(tmp);
-        }
-        /* Do not understand option for what graph */
-        else
-        {
-            usage();
-        }
     }
 
     public static void usage()




More information about the Swift-commit mailing list