/* * Decompiled with CFR 0.152. */ package com.tridium.util; import java.util.Vector; public class CommandLineArguments { public final String[] parameters; public final String[] options; public final String[] optionValues; public boolean hasHelpOption() { if (this.hasOption("?")) { return true; } if (this.hasOption("help")) { return true; } return this.hasOption("usage"); } public boolean hasOption(String string) { int n = 0; while (n < this.options.length) { if (this.options[n].equals(string)) { return true; } ++n; } return false; } public String getOption(String string) { return this.getOption(string, null); } public String getOption(String string, String string2) { int n = 0; while (n < this.options.length) { if (this.options[n].equals(string)) { if (this.optionValues[n] == null) break; return this.optionValues[n]; } ++n; } return string2; } public int getIntOption(String string, int n) { int n2 = 0; while (n2 < this.options.length) { if (this.options[n2].equals(string)) { return Integer.parseInt(this.optionValues[n2]); } ++n2; } return n; } public void dump() { int n = 0; while (n < this.parameters.length) { System.out.println(this.parameters[n] + " [" + n + ']'); ++n; } n = 0; while (n < this.options.length) { if (this.optionValues[n] == null) { System.out.println("-" + this.options[n]); } else { System.out.println("-" + this.options[n] + ':' + this.optionValues[n]); } ++n; } } public static void main(String[] stringArray) { new CommandLineArguments(stringArray).dump(); } public CommandLineArguments(String[] stringArray) { Vector vector = new Vector(); Vector vector2 = new Vector(); Vector vector3 = new Vector(); int n = 0; while (n < stringArray.length) { String string = stringArray[n]; if (string.length() > 1 && string.charAt(0) == '-') { int n2 = (string = string.substring(1)).indexOf(58); if (n2 > 0) { vector2.addElement(string.substring(0, n2)); vector3.addElement(string.substring(n2 + 1)); } else { vector2.addElement(string); vector3.addElement(null); } } else { vector.addElement(string); } ++n; } this.parameters = new String[vector.size()]; vector.copyInto(this.parameters); this.options = new String[vector2.size()]; vector2.copyInto(this.options); this.optionValues = new String[vector3.size()]; vector3.copyInto(this.optionValues); } }