Methods Summary |
---|
public void | addDeprecatedOption(ValidOption option)Adds the deprecated option to the deprecated options list
if ((option != null) && !hasDeprecatedOption(option.getName()))
{
deprecatedOptions.add(option);
}
|
public void | addRequiredOption(ValidOption option)Adds the required option to the required options list
if ((option != null) && !hasRequiredOption(option.getName()))
{
requiredOptions.add(option);
}
|
public void | addValidOption(ValidOption option)Add ValidOption object to the valid option list
if ((option != null) && !hasValidOption(option.getName()))
{
validOptions.add(option);
}
|
public void | deleteOption(ValidOption option)Deletes the option from the options list
if (option != null)
{
validOptions.remove(option);
}
|
public ValidOption | getAlternateDeprecatedOption(java.lang.String optionName)Returns the alternate deprecated option
Vector allOptions = new Vector(validOptions);
allOptions.addAll(requiredOptions);
boolean hasAltDeprecatedOption = false;
ValidOption altDeprecatedOption = null;
for (int i = 0; (i < allOptions.size()) && !hasAltDeprecatedOption; i++)
{
ValidOption validOption = (ValidOption)allOptions.get(i);
final String deprecatedOptionStr = validOption.getDeprecatedOption();
if ((deprecatedOptionStr != null) &&
(deprecatedOptionStr.equals(optionName)))
{
hasAltDeprecatedOption = true;
altDeprecatedOption = validOption;
}
}
return altDeprecatedOption;
|
public java.lang.String | getClassName()Returns the class name for this command
return className;
|
public java.lang.String | getDefaultOperand()Get the default operand for this command
defaultoperand is valid if numberofoperand attribute is
either * or ?. If the numberofoperand is finite or "+"
then this attribute is ignored.
return this.defaultOperand;
|
public java.util.Vector | getDeprecatedOptions()Gets the list of deprecated options for this command
return deprecatedOptions;
|
public java.lang.String | getName()Get the name of the command
return name;
|
public java.lang.String | getNumberOfOperands()Returns the number of operands in this Command
return numberOfOperands;
|
public ValidOption | getOption(java.lang.String longOptionName)Returns the option which matches in the options list
Vector allOptions = this.getOptions();
if (longOptionName != null) {
for (int ii=0; ii<allOptions.size(); ii++)
{
ValidOption option = (ValidOption)allOptions.get(ii);
if ((option.getName()).equals(longOptionName))
return option;
}
}
return null;
|
public java.util.Vector | getOptions()Gets all the options (required and valid)
Vector options = new Vector(validOptions);
options.addAll(requiredOptions);
options.addAll(deprecatedOptions);
return options;
|
public java.util.Hashtable | getProperties()Gets all the properties of the command
return properties;
|
public java.lang.Object | getProperty(java.lang.String key)Searches for the property with the specified key in this properties list
return properties.get(key);
|
public java.util.Vector | getRequiredOptions()Gets the list of required options for this command
return requiredOptions;
|
public java.lang.String | getUsageText()Return the usage text
return usageText;
|
public java.util.Vector | getValidOptions()Returns the list of valid options for this command
return validOptions;
|
public boolean | hasAlternateDeprecatedOption(java.lang.String optionName)Checks if the alternate deprecated option exists
Vector allOptions = new Vector(validOptions);
allOptions.addAll(requiredOptions);
boolean hasAltDeprecatedOption = false;
for (int i = 0; (i < allOptions.size()) && !hasAltDeprecatedOption; i++)
{
String deprecatedOptionStr =
((ValidOption)allOptions.get(i)).getDeprecatedOption();
if ((deprecatedOptionStr != null) &&
(deprecatedOptionStr.equals(optionName)))
{
hasAltDeprecatedOption = true;
}
}
return hasAltDeprecatedOption;
|
public boolean | hasDeprecatedOption(java.lang.String optionName)Checks if the deprecated option exists
boolean hasDeprecatedOption = false;
for (int i = 0; (i < deprecatedOptions.size()) && !hasDeprecatedOption; i++)
{
if (((ValidOption)deprecatedOptions.get(i)).getName().equals(optionName))
hasDeprecatedOption = true;
}
return hasDeprecatedOption;
|
public boolean | hasDeprecatedOption(ValidOption option)Checks if the deprecated option exists
return deprecatedOptions.contains(option);
|
public boolean | hasProperty(java.lang.String propertyName)Finds if a property by name exists in the list
return properties.containsKey(propertyName);
|
public boolean | hasRequiredOption(java.lang.String optionName)Checks if the required option exists
boolean hasRequiredOption = false;
for (int i = 0; (i < requiredOptions.size()) && !hasRequiredOption; i++)
{
if (((ValidOption)requiredOptions.get(i)).getName().equals(optionName))
hasRequiredOption = true;
}
return hasRequiredOption;
|
public boolean | hasRequiredOption(ValidOption option)Checks if the required option exists
return requiredOptions.contains(option);
|
public boolean | hasValidOption(java.lang.String optionName)Checks if the option exists
boolean hasValidOption = false;
if (optionName != null) {
for (int i = 0; (i < validOptions.size()) && !hasValidOption; i++)
{
if (((ValidOption)validOptions.get(i)).getName().equals(optionName))
hasValidOption = true;
}
}
return hasValidOption;
|
public boolean | hasValidOption(ValidOption option)Checks if the option exists
return validOptions.contains(option);
|
public void | replaceAllOptions(ValidOption replaceOption)Calls ReplaceOptionsList to relace the options with replaceOption
in validOptions, requiredOptions and deprecatedOptions.
if (replaceOption != null)
{
final String replaceOptionName = replaceOption.getName();
if (hasValidOption(replaceOptionName))
{
replaceOptionsList(validOptions, replaceOption);
}
if (hasRequiredOption(replaceOptionName))
{
replaceOptionsList(requiredOptions, replaceOption);
}
if (hasDeprecatedOption(replaceOptionName))
{
replaceOptionsList(deprecatedOptions, replaceOption);
}
}
|
private void | replaceOptionsList(java.util.Vector optionsList, ValidOption replaceOption)Search in the options list and replace it with replaceOption object.
final String replaceOptionName = replaceOption.getName();
for (int ii = 0; ii<optionsList.size(); ii++)
{
try {
if (((ValidOption)optionsList.get(ii)).getName().equals(replaceOptionName))
{
if (((ValidOption)optionsList.get(ii)).hasDeprecatedOption()) {
final String deprecatedOption=((ValidOption)optionsList.get(ii)).getDeprecatedOption();
replaceOption.setDeprecatedOption(deprecatedOption);
}
optionsList.set(ii, replaceOption);
break;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return;
|
public void | setClassName(java.lang.String className)Sets the class name for this command
this.className = className;
|
public void | setDefaultOperand(java.lang.String defaultOperand)Sets the default operand for this command
defaultoperand is valid if numberofoperand attribute is
either * or ?. If the numberofoperand is finite or "+"
then this attribute is ignored and set to nil.
if (defaultOperand != null &&
numberOfOperands.matches(DEFAULTOPERAND_QUANTIFIER_REGEXP))
{
this.defaultOperand = defaultOperand;
}
else
this.defaultOperand = null;
|
public void | setDeprecatedOptions(java.util.Vector deprecatedOptions)Sets the list of Deprecated options for this command
this.deprecatedOptions = deprecatedOptions;
|
public void | setName(java.lang.String name)Sets the name of the Valid Command
this.name = name;
|
public void | setNumberOfOperands(java.lang.String numberOfOperands)Sets the number of operands for this command
this.numberOfOperands = numberOfOperands;
|
public void | setProperty(java.lang.String key, java.lang.Object value)Sets the properties of the command
properties.put(key, value);
|
public void | setRequiredOptions(java.util.Vector requiredOptions)Sets the list of Required options for this command
this.requiredOptions = requiredOptions;
|
public void | setUsageText(java.lang.String usageText)
this.usageText = usageText;
|
public void | setValidOptions(java.util.Vector validOptions)Sets the list of valid options for this command
this.validOptions = validOptions;
|
public java.lang.String | toString()Returns the toString()
String validOptionsStr = "{";
for (int i = 0; i < validOptions.size(); i++)
{
validOptionsStr += validOptions.get(i).toString() + ",";
}
validOptionsStr += "}";
String requiredOptionsStr = "";
for (int i = 0; i < requiredOptions.size(); i++)
{
requiredOptionsStr += requiredOptions.get(i).toString() + ",";
}
requiredOptionsStr += "}";
String deprecatedOptionsStr = "";
for (int i = 0; i < deprecatedOptions.size(); i++)
{
deprecatedOptionsStr += deprecatedOptions.get(i).toString() + ",";
}
deprecatedOptionsStr += "}";
String propertiesStr = "{";
for (Enumeration propertyNames = properties.keys() ; propertyNames.hasMoreElements() ;)
{
String name = (String) propertyNames.nextElement();
Vector value = (Vector) properties.get(name);
propertiesStr += "|" + name + " , " + value;
}
propertiesStr += "}";
return (name + " " + numberOfOperands + " | " + validOptionsStr +
" | " + requiredOptionsStr + " | " +
" | " + deprecatedOptionsStr + " | " + usageText + " " +
propertiesStr);
|