Argument parsing

This simple example provides arguments to the Grooovy API as an ArrayList:
                    import kcl.waterloo.plot.WPlot
                    p=WPlot.scatter(['XData', 1..10, 'YData', 1..10])
                    
The input is treated in two stages:
  1. parsing This stage creates a LinkedHashMap based on the input. It accepts inputs that are more loosely formatted than subsequent stages; for example, when an ArrayList is provided as input, the parsing stage does not care about the case of the property names: "XData", "xData" or "XDATA" ,for example, will all be treated the same. It is also more liberal about the types of values associated with the property names.
  2. processing This stage sets the properties of the generated plot according to the values in the LinkedHashMap generated in the parsing stage above. The keys for the map at this stage are treated in a case-sensitive way and the values associated with the keys must be constrained not to generate run-time exceptions.
You can parse the input to a plot method explicitly in code to generated an approprately formated LinkedHashMap by calling the "preParseArgs" static method which is publicly available:
                    import kcl.waterloo.plot.WPlot
                    def map=WPlot.preParseArgs(['XData', 1..10, 'YData', 1..10])
                    
In the Groovy Console this will return:
                    Result: ['XData':[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0],
                        'YData':[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]]
                    
in map.