Author: scooter
Date: 2010-01-29 22:08:39 -0800 (Fri, 29 Jan 2010)
New Revision: 19081
Removed:
cytoscape/trunk/src/cytoscape/command/HelpCommand.java
Modified:
cytoscape/trunk/src/cytoscape/command/AbstractCommandHandler.java
cytoscape/trunk/src/cytoscape/command/CyCommandManager.java
Log:
Removed help
Modified: cytoscape/trunk/src/cytoscape/command/AbstractCommandHandler.java
===================================================================
--- cytoscape/trunk/src/cytoscape/command/AbstractCommandHandler.java
2010-01-30 06:06:32 UTC (rev 19080)
+++ cytoscape/trunk/src/cytoscape/command/AbstractCommandHandler.java
2010-01-30 06:08:39 UTC (rev 19081)
@@ -193,7 +193,7 @@
*/
public String getDescription(String command) {
if (descriptionMap.containsKey(command)) {
- return formatDescription(command,
descriptionMap.get(command), argumentMap.get(command));
+ return descriptionMap.get(command);
}
return null;
}
@@ -357,63 +357,6 @@
}
/**
- * This method can be used to create a formatted description that
includes
- * the namespace, command, and options.
- *
- * @param command the command
- * @param description the textual description
- * @return the formatted text
- */
- protected String formatDescription(String command, String description) {
- if (!argumentMap.containsKey(command)) {
- List<Tunable> args = argumentMap.get(command);
- return formatDescription(command, description, args);
- }
- return formatDescription(command, description, new ArrayList());
- }
-
- /**
- * This method can be used to create a formatted description that
includes
- * the namespace, command, and options.
- *
- * @param command the command
- * @param description the textual description
- * @param args the list of arguments for this command
- * @return the formatted text
- */
- protected String formatDescription(String command, String description,
Collection<Tunable>args) {
- String descr = namespace.getNamespaceName()+" "+command+":
"+description;
- if (args == null || args.size() == 0) return descr;
- descr += "\n Arguments:\n";
- for (Tunable arg: args) {
- descr += " [";
- if (arg.getName() != null)
- descr += arg.getName();
- if (arg.getDescription() != null &&
!arg.getDescription().equals(arg.getName()))
- descr += "("+arg.getDescription()+")";
- if (arg.getValue() != null)
- descr += "="+arg.getValue();
- else
- descr += "=value";
- descr += "]\n";
- }
- return descr;
- }
-
- /**
- * This method can be used to create a formatted description that
includes
- * the namespace, command, and options.
- *
- * @param command the command
- * @param description the textual description
- * @param args the list of arguments for this command
- * @return the formatted text
- */
- protected String formatDescription(String command, String description,
Map<String, Object>args) {
- return formatDescription(command, description,
createTunableCollection(args));
- }
-
- /**
* This method is useful for converting from Tunable lists to key-value
settings
*/
private Map<String, Object> createKVSettings(String command) {
@@ -421,7 +364,7 @@
return createKVMap(argumentMap.get(command));
}
- private Tunable makeTunable(String name, Object value) {
+ static public Tunable makeTunable(String name, Object value) {
Class vClass = value.getClass();
if (vClass == Double.class || vClass == Float.class) {
return new Tunable(name, name, Tunable.DOUBLE, value);
Modified: cytoscape/trunk/src/cytoscape/command/CyCommandManager.java
===================================================================
--- cytoscape/trunk/src/cytoscape/command/CyCommandManager.java 2010-01-30
06:06:32 UTC (rev 19080)
+++ cytoscape/trunk/src/cytoscape/command/CyCommandManager.java 2010-01-30
06:08:39 UTC (rev 19081)
@@ -58,18 +58,10 @@
public class CyCommandManager {
private static Map<CyCommandNamespace, Map<String,CyCommandHandler>>
comMap;
private static Map<String, CyCommandNamespace> nsMap;
- private static CyCommandHandler helpHandler = null;
- private static CyCommandNamespace helpNS = null;
static {
comMap = new HashMap<CyCommandNamespace, Map<String,CyCommandHandler>>();
nsMap = new HashMap<String, CyCommandNamespace>();
-
- // special case for help
- helpNS = reserveNamespace(HelpCommand.HELP);
- helpHandler = new HelpCommand();
- // Register the empty help string
- register(helpNS, "", helpHandler);
}
public static CyCommandNamespace reserveNamespace(String namespace)
throws RuntimeException {
@@ -83,8 +75,6 @@
nsMap.put(namespace, ns);
comMap.put(ns, new HashMap());
- // Add this namespace to help
- register(helpNS, namespace, helpHandler);
return ns;
}
Deleted: cytoscape/trunk/src/cytoscape/command/HelpCommand.java
===================================================================
--- cytoscape/trunk/src/cytoscape/command/HelpCommand.java 2010-01-30
06:06:32 UTC (rev 19080)
+++ cytoscape/trunk/src/cytoscape/command/HelpCommand.java 2010-01-30
06:08:39 UTC (rev 19081)
@@ -1,105 +0,0 @@
-/* vim: set ts=2: */
-/**
- * Copyright (c) 2009 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions, and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * 3. Redistributions must acknowledge that this software was
- * originally developed by the UCSF Computer Graphics Laboratory
- * under support by the NIH National Center for Research Resources,
- * grant P41-RR01081.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-package cytoscape.command;
-
-import cytoscape.Cytoscape;
-import cytoscape.command.CyCommandException;
-import cytoscape.command.CyCommandHandler;
-import cytoscape.command.CyCommandManager;
-import cytoscape.command.CyCommandResult;
-import cytoscape.layout.Tunable;
-import cytoscape.logger.CyLogger;
-import cytoscape.view.CyNetworkView;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This Command provides an interface to list commands, subcommands and
- * their settings
- */
-class HelpCommand implements CyCommandHandler {
- public final static String HELP = "help";
-
- public CyCommandResult execute(String command, Map<String, Object>args)
throws CyCommandException {
- CyCommandResult result = new CyCommandResult();
-
- if (command == null || command.length() == 0) {
- result.addMessage("Available commands: ");
- for ( String ns : CyCommandManager.getNamespaceList() )
- result.addMessage(" "+ns);
-
- result.addMessage("For detailed information type: ");
- result.addMessage(" help command");
- } else {
- // See if we have a command arg...
- if (args != null && args.size() > 0) {
- // We do, get the command we want details on
- for (String subc: args.keySet()) {
- CyCommandHandler ch =
CyCommandManager.getCommand(command, subc);
- String desc = ch.getDescription(subc);
- if (desc == null)
- result.addMessage("Detailed
information on '" + command + " " + subc+"' is not available ");
- else
- result.addMessage(desc);
- break;
- }
- } else {
- result.addMessage("Available " + command + "
commands: ");
- for ( String c :
CyCommandManager.getCommandList(command) )
- result.addMessage(" "+ command + " " +
c);
- }
- }
-
- return result;
- }
-
- public CyCommandResult execute(String command, Collection<Tunable>
arguments) throws CyCommandException {
- return execute( command, new HashMap<String,Object>() );
- }
-
- public List<String> getCommands() {
- return CyCommandManager.getNamespaceList();
- }
-
- public List<String> getArguments(String command) { return new
ArrayList<String>(); }
- public Map<String, Object> getSettings(String command) { return new
HashMap<String,Object>(); }
- public Map<String, Tunable> getTunables(String command) { return new
HashMap<String,Tunable>(); }
-
- public String getDescription(String command) {
- return "The 'help' command returns information about available
commands. For detailed information, type: 'help command'";
- }
-}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.