Skip to content

Commit

Permalink
Merge pull request #17077 from keithc-ca/javadoc
Browse files Browse the repository at this point in the history
Fix javadoc errors and add explicit constructors
  • Loading branch information
pshipton authored Mar 31, 2023
2 parents 2f292f3 + b616bb7 commit 511fc3d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,38 @@
import com.ibm.dtfj.java.JavaRuntime;

/**
* Factory for creating different types of context
*
* @author adam
* Factory for creating different types of contexts.
*
* @author adam
*/
public class ContextFactory {


private ContextFactory() {
/* no instances needed */
}

/**
* Create a DTFJ context
*
* Create a DTFJ context.
*
* @param major DTFJ API major version to be supported
* @param minor DTFJ minor version to be supported
* @param image the source image for the context
* @param space address space for this context (cannot be null)
* @param process in this address space
* @param rt Java runtime for this context (may be null)
* @param process process in this address space
* @param runtime Java runtime for this context (may be null)
* @return the context
*/
public static IDTFJContext getContext(final int major, final int minor,final Image image, final ImageAddressSpace space, final ImageProcess proc, final JavaRuntime rt) {
DTFJContext ctx = new DTFJContext(major, minor, image, space, proc, rt);
public static IDTFJContext getContext(final int major, final int minor, final Image image, final ImageAddressSpace space, final ImageProcess process, final JavaRuntime runtime) {
DTFJContext ctx = new DTFJContext(major, minor, image, space, process, runtime);
ctx.refresh();
return ctx;
}

/**
* Create a stub DTFJ context which just contains the global commands
*
* Create a stub DTFJ context which just contains the global commands.
*
* @param major DTFJ API major version to be supported
* @param minor DTFJ minor version to be supported
* @return the context
*/
public static IDTFJContext getEmptyContext(final int major, final int minor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,38 @@
import com.ibm.java.diagnostics.utils.plugins.PluginConfig;

/**
* Base command which supplies basic support
*
* @author adam
* Base command which supplies basic support.
*
* @author adam
*/
public abstract class BaseCommand implements ICommand {

protected static final String nl = System.getProperty("line.separator");
protected static final String COMMAND_FORMAT = "%-25s %-20s %s\n";
protected static final String SUBCOMMAND_FORMAT = "%25s %-20s %s\n";
private static final String KEY_ID = ":";

private Map<String,CommandDescription> _commands = new LinkedHashMap<String,CommandDescription>();
private Map<String,CommandDescription> _subCommands = new LinkedHashMap<String,CommandDescription>();

private boolean isDirty = false; //indicates if a command or subcommand has been added

private Set<String> descriptions = new LinkedHashSet<String>();
protected PluginConfig config; //configuration used to generate this command

private final Map<String, CommandDescription> _commands = new LinkedHashMap<>();
private final Map<String, CommandDescription> _subCommands = new LinkedHashMap<>();

private boolean isDirty = false; // indicates if a command or subcommand has been added

private final Set<String> descriptions = new LinkedHashSet<>();
protected PluginConfig config; // configuration used to generate this command

protected BaseCommand() {
super();
}

/**
*
*
* @param name Command Name
* @param argDescription Brief name of any optional or required arguments
* @param helpDescription One-liner Description of the command
*
* argDescription should be a word describing the argument name.
* e.g: <address> to specify an address argument that is mandatory
* [address] to specify an address argument that is optional
*
* @param argDescription brief description of any optional or required arguments
* @param helpDescription one-line description of the command
*
* argDescription should be a word describing the argument name,
* e.g: &lt;address> to specify an address argument that is mandatory, or
* [address] to specify an address argument that is optional
*/
public CommandDescription addCommand(String name, String argDescription, String helpDescription)
{
Expand All @@ -69,7 +72,7 @@ public CommandDescription addCommand(String name, String argDescription, String
_commands.put(name.toLowerCase(), description);
return description;
}

public void addSubCommand(String cmdname, String subname, String argDescription, String help)
{
isDirty = true;
Expand All @@ -81,7 +84,7 @@ public void addSubCommand(String cmdname, String subname, String argDescription,
}
_subCommands.put(cmdname + KEY_ID + subname, subCommand);
}

public boolean recognises(String command, IContext context) {
return _commands.containsKey(command.toLowerCase());
}
Expand Down Expand Up @@ -109,7 +112,7 @@ public Collection<String> getCommandNames() {
public PluginConfig getConfig() {
return config;
}

public void setConfig(PluginConfig config) {
this.config = config;
}
Expand Down

0 comments on commit 511fc3d

Please sign in to comment.