00001 #ifndef EST_ANALYZER_FACTORY_CPP
00002 #define EST_ANALYZER_FACTORY_CPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "ESTAnalyzerFactory.h"
00038 #include "arg_parser.h"
00039
00040 #include "FMWSCA.h"
00041 #include "CLU.h"
00042 #include "D2.h"
00043 #include "D2Zim.h"
00044 #include "TwoPassD2.h"
00045 #include "MatrixFileAnalyzer.h"
00046
00047 void
00048 ESTAnalyzerFactory::displayList(std::ostream &os) {
00049
00050
00051 arg_parser::arg_record dummy_args[] = {
00052 {"fmwsca", "Framed, Multi-Word String Compare Analyzer",
00053 NULL, arg_parser::STRING},
00054 {"clu", "CLU's similarity metric generation algorithm",
00055 NULL, arg_parser::STRING},
00056 {"matrixFile", "Use distance data stored in a matrix file",
00057 NULL, arg_parser::STRING},
00058 {"d2", "Use D2 (wcd-based) distance metric generation algorithm",
00059 NULL, arg_parser::STRING},
00060 {"d2zim", "Use D2 (Zimmerman) distance metric generation algorithm",
00061 NULL, arg_parser::STRING},
00062 {"twopassD2", "Use two-pass asymmetric/bounded symmetric D2",
00063 NULL, arg_parser::STRING},
00064
00065
00066 {NULL, NULL, NULL, arg_parser::BOOLEAN}
00067 };
00068 arg_parser dummyParser(dummy_args);
00069 os << dummyParser;
00070 }
00071
00072 ESTAnalyzer*
00073 ESTAnalyzerFactory::create(const char* name, const int refESTidx,
00074 const std::string& outputFileName) {
00075 if (name == NULL) {
00076 return NULL;
00077 }
00078 if (refESTidx < 0) {
00079 std::cerr << "A reference EST index has not been specified.\n"
00080 << "Use --estIdx command line option." << std::endl;
00081 return NULL;
00082 }
00083
00084 if (!strcmp("fmwsca", name)) {
00085 return new FMWSCA(refESTidx, outputFileName);
00086 } else if (!strcmp("clu", name)) {
00087 return new CLU(refESTidx, outputFileName);
00088 } else if (!strcmp("matrixFile", name)) {
00089 return new MatrixFileAnalyzer(refESTidx, outputFileName);
00090 } else if (!strcmp("d2", name)) {
00091 return new D2(refESTidx, outputFileName);
00092 } else if (!strcmp("d2zim", name)) {
00093 return new D2Zim(refESTidx, outputFileName);
00094 } else if (!strcmp("twopassD2", name)) {
00095 return new TwoPassD2(refESTidx, outputFileName);
00096
00097
00098 }
00099
00100
00101 std::cerr << "Invalid analyzer name." << std::endl;
00102 return NULL;
00103 }
00104
00105 #endif