]> git.donarmstrong.com Git - mothur.git/blobdiff - commandfactory.cpp
added sorted parameter to get.oturep, added error checking to chimera classes in...
[mothur.git] / commandfactory.cpp
index c85326854b1253710f8f56e7bcacf37290cc1ed5..c33de86f5c5a97fe9599a8871b190194170e1a6c 100644 (file)
 #include "classifyseqscommand.h"
 #include "phylotypecommand.h"
 
+/*******************************************************/
+
+/******************************************************/
+CommandFactory* CommandFactory::getInstance() {
+       if( _uniqueInstance == 0) {
+               _uniqueInstance = new CommandFactory();
+       }
+       return _uniqueInstance;
+}
 /***********************************************************/
 
 /***********************************************************/
 CommandFactory::CommandFactory(){
+       _uniqueInstance = 0;
        string s = "";
        command = new NoCommand(s);
        
@@ -114,7 +124,7 @@ CommandFactory::CommandFactory(){
        commands["system"]                              = "system";
        commands["align.check"]                 = "align.check";
        commands["get.sharedseqs"]              = "get.sharedseqs";
-       commands["get.listcount"]               = "get.listcount";
+       commands["get.otulist"]                 = "get.otulist";
        commands["quit"]                                = "quit"; 
        commands["hcluster"]                    = "hcluster"; 
        commands["classify.seqs"]               = "classify.seqs"; 
@@ -181,8 +191,8 @@ Command* CommandFactory::getCommand(string commandName, string optionString){
                else if(commandName == "merge.files")                   {       command = new MergeFileCommand(optionString);                   }
                else if(commandName == "system")                                {       command = new SystemCommand(optionString);                              }
                else if(commandName == "align.check")                   {       command = new AlignCheckCommand(optionString);                  }
-               else if(commandName == "get.sharedseqs")                        {       command = new GetSharedOTUCommand(optionString);                }
-               else if(commandName == "get.listcount")                 {       command = new GetListCountCommand(optionString);                }
+               else if(commandName == "get.sharedseqs")                {       command = new GetSharedOTUCommand(optionString);                }
+               else if(commandName == "get.otulist")                   {       command = new GetListCountCommand(optionString);                }
                else if(commandName == "hcluster")                              {       command = new HClusterCommand(optionString);                    }
                else if(commandName == "classify.seqs")                 {       command = new ClassifySeqsCommand(optionString);                }
                else if(commandName == "phylotype")                             {       command = new PhylotypeCommand(optionString);                   }
@@ -195,7 +205,22 @@ Command* CommandFactory::getCommand(string commandName, string optionString){
                exit(1);
        }
 }
+/***********************************************************/
+//This function is used to interrupt a command
+Command* CommandFactory::getCommand(){
+       try {
+               delete command;   //delete the old command
 
+               string s = "";
+           command = new NoCommand(s);
+       
+               return command;
+       }
+       catch(exception& e) {
+               errorOut(e, "CommandFactory", "getCommand");
+               exit(1);
+       }
+}
 /***********************************************************************/
 bool CommandFactory::isValidCommand(string command) {
        try {