continue;
} else if (arg.equals("-lx")) {
double[] spec = _parseDoubles(args[i++]);
if (spec.length == 1) {
throw new CmdLineArgException("Failed to parse `" + arg
+ "'");
} else {
_plot.setXRange(spec[0], spec[1]);
}
continue;
} else if (arg.equals("-ly")) {
double[] spec = _parseDoubles(args[i++]);
if (spec.length == 1) {
throw new CmdLineArgException("Failed to parse `" + arg
+ "'");
} else {
_plot.setYRange(spec[0], spec[1]);
}
continue;
} else if (arg.equals("-t")) {
// -t <title> TitleText "An X Graph"
String title = args[i++];
_plot.setTitle(title);
continue;
} else if (arg.equals("-tf")) {
// -tf <titlefont>
_plot.setTitleFont(args[i++]);
continue;
} else if (arg.equals("-x")) {
// -x <unitName> XUnitText XLabel:
_plot.setXLabel(args[i++]);
continue;
} else if (arg.equals("-y")) {
// -y <unitName> YUnitText YLabel:
_plot.setYLabel(args[i++]);
continue;
} else if (arg.equals("-bar")) {
//-bar BarGraph Bars: on Marks: none Lines: off
// If we saw the -nl arg, then assume impulses
sawbararg = true;
if (sawnlarg) {
_plot.setImpulses(true);
} else {
_plot.setBars(true);
_plot.setMarksStyle("none");
}
_plot.setConnected(false);
continue;
} else if (arg.equals("-binary")) {
_binary = true;
_endian = _NATIVE_ENDIAN;
continue;
} else if (arg.equals("-bigendian")) {
_binary = true;
_endian = _BIG_ENDIAN;
continue;
} else if (arg.equals("-littleendian")) {
_binary = true;
_endian = _LITTLE_ENDIAN;
continue;
} else if (arg.equals("-db")) {
//_debug = 10;
continue;
} else if (arg.equals("-debug")) {
// -debug is not in the original X11 pxgraph.
//_debug = (int) Integer.valueOf(args[i++]).intValue();
continue;
} else if (arg.equals("-fg")) {
_plot.setForeground(PlotBox.getColorByName(args[i++]));
continue;
} else if (arg.equals("-help")) {
// -help is not in the original X11 pxgraph.
//_help();
continue;
} else if (arg.equals("-impulses")) {
// -impulses is not in the original X11 pxgraph.
_plot.setImpulses(true);
_plot.setConnected(false);
continue;
} else if (arg.equals("-lnx")) {
_plot.setXLog(true);
continue;
} else if (arg.equals("-lny")) {
_plot.setYLog(true);
continue;
} else if (arg.equals("-m")) {
// -m Markers Marks: various
_plot.setMarksStyle("various");
savedmarks = "various";
continue;
} else if (arg.equals("-M")) {
// -M StyleMarkers Marks: various
_plot.setMarksStyle("various");
savedmarks = "various";
continue;
} else if (arg.equals("-nl")) {
// -nl NoLines Lines: off
// If we saw the -bar arg, then assume impulses
sawnlarg = true;
if (sawbararg) {
// Restore the _marks in case we did -P -bar -nl
_plot.setMarksStyle(savedmarks);
_plot.setBars(false);
_plot.setImpulses(true);
}
_plot.setConnected(false);
continue;
} else if (arg.equals("-o")) {
// -o <output filename>
// _outputFile = args[i++];
i++;
continue;
} else if (arg.equals("-p")) {
// -p PixelMarkers Marks: points
_plot.setMarksStyle("points");
savedmarks = "points";
continue;
} else if (arg.equals("-P")) {
// -P LargePixel Marks: dots\n
_plot.setMarksStyle("dots");
savedmarks = "dots";
continue;
} else if (arg.equals("-print")) {
// -print is not in the original X11 pxgraph.
continue;
} else if (arg.equals("-rv")) {
_plot.setBackground(PlotBox.getColorByName("black"));
_plot.setForeground(PlotBox.getColorByName("white"));
continue;
} else if (arg.equals("-test")) {
// -test is not in the original X11 pxgraph.
//_test = true;
continue;
} else if (arg.equals("-tk")) {
_plot.setGrid(false);
continue;
} else if (arg.equals("-v") || arg.equals("-version")) {
// -version is not in the original X11 pxgraph.
//_version();
continue;
} else if ((arg.length() > 1) && (arg.charAt(0) == '-')) {
// Process '-<digit> <datasetname>'
try {
Integer datasetnumberint = Integer.valueOf(arg
.substring(1));
int datasetnumber = datasetnumberint.intValue();
if (datasetnumber >= 0) {
_plot.addLegend(datasetnumber, args[i++]);
continue;
}
} catch (NumberFormatException e) {
}
}
} else {
if (arg.startsWith("=")) {
// Process =WxH+X+Y
width = Integer.valueOf(arg.substring(1, arg.indexOf('x')))
.intValue();
int plusIndex = arg.indexOf('+');
int minusIndex = arg.indexOf('-');
if ((plusIndex != -1) || (minusIndex != -1)) {
// =WxH+X+Y, =WxH-X+Y, =WxH-X-Y, =WxH+X-Y
if ((plusIndex != -1) && (minusIndex != -1)) {
// =WxH-X+Y or =WxH+X-Y
int index = minusIndex;
if (plusIndex < minusIndex) {
index = plusIndex;
}
height = Integer.valueOf(
arg.substring(arg.indexOf('x') + 1, index))
.intValue();
} else {
if (plusIndex != -1) {
// =WxH+X+Y
height = Integer.valueOf(
arg.substring(arg.indexOf('x') + 1,
plusIndex)).intValue();
} else {
// =WxH-X-Y
height = Integer.valueOf(
arg.substring(arg.indexOf('x') + 1,
minusIndex)).intValue();
}
}
} else {
if (arg.length() > arg.indexOf('x')) {
// =WxH
height = Integer.valueOf(
arg.substring(arg.indexOf('x') + 1, arg
.length())).intValue();
}
}
// FIXME: it is unclear what X and Y in =WxH+X+Y mean
// in a non-toplevel window, so we don't process
// those here. See Pxgraph.java for how to process
// X and Y for a toplevel window.
continue;
}
}
if (arg.equals("-")) {
sawDash = true;
} else {
// If we got to here, then we failed to parse the arg
throw new CmdLineArgException("Failed to parse `" + arg + "'");
}
}
argumentsRead = i++;