Example usage for java.lang String equals

List of usage examples for java.lang String equals

Introduction

In this page you can find the example usage for java.lang String equals.

Prototype

public boolean equals(Object anObject) 

Source Link

Document

Compares this string to the specified object.

Usage

From source file:com.makkajai.ObjCToCpp.java

/**
 * Main Method/*from w ww .jav a2  s  .c  o m*/
 *
 * @param args - First argument is the input directory to scan and second is the output directory to write files to.
 * @throws IOException
 */
public static void main(String[] args) throws IOException {

    if (args.length < 2) {
        System.out.println("Invalid Arguments!");
        System.out.println(
                "Usage: java com.makkajai.ObjCToCpp \"<directory to scan for .h and .m files>\" \"<directory to write .h and .cpp files>\"");
        return;
    }

    String inputDirectory = args[0];
    String outputDirectory = args[1];
    //     String inputDirectory = "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/scenes";
    //     String outputDirectory = "/Users/administrator/playground/projarea/monster-math-cross-platform/monster-math-2/Classes/Makkajai/scenes";

    List<String> exceptFiles = new ArrayList<String>();

    if (args.length == 3) {
        BufferedReader bufferedInputStream = new BufferedReader(new FileReader(args[2]));
        String exceptFile = null;
        while ((exceptFile = bufferedInputStream.readLine()) != null) {
            if (exceptFile.equals(""))
                continue;
            exceptFiles.add(exceptFile);
        }
    }

    //Getting all the files from the input directory.
    final List<File> files = new ArrayList<File>(FileUtils.listFiles(new File(inputDirectory),
            new RegexFileFilter(FILE_NAME_WITH_H_OR_M), DirectoryFileFilter.DIRECTORY));

    //        String fileName =
    ////                "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/Utils/MakkajaiEnum"
    ////                "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/Utils/MakkajaiUtil"
    ////                "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/Home"
    ////                "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/Activities/gnumchmenu/PlayStrategy"
    ////                "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/Characters/Character"
    //                "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/Activities/gnumchmenu/GnumchScene"
    ////                "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/ParentScene"
    ////                "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/BaseSkillView"
    ////                "/Users/administrator/playground/projarea/math-monsters-2/makkajai-number-muncher/makkajai-ios/Makkajai/Makkajai/YDLayerBase"
    //                ;
    //The instance of the translator.
    ObjCToCppTranslator visitor = new ObjCToCppTranslator();

    for (int i = 0; i < files.size();) {
        File currentFile = files.get(i);
        String filePathRelativeToInput = currentFile.getAbsolutePath().replace(inputDirectory, "");
        Date startTime = new Date();
        try {
            final TranslateFileInput translateFileInput = new TranslateFileInput(inputDirectory,
                    outputDirectory, filePathRelativeToInput, false);
            if (nextFileIsM(currentFile, files, i)) {
                try {
                    if (isIgnoredFile(filePathRelativeToInput, exceptFiles))
                        continue;
                    translateFileInput.dryRun = true;
                    visitor.translateFile(translateFileInput);
                    Date stopTime = new Date();
                    System.out.println("Dry run File: " + translateFileInput.filePathRelativeToInput
                            + " Time Taken: " + getDelta(startTime, stopTime));

                    Date startTime1 = new Date();
                    translateFileInput.filePathRelativeToInput = filePathRelativeToInput.replace(H, M);
                    translateFileInput.dryRun = false;
                    visitor.translateFile(translateFileInput);
                    stopTime = new Date();
                    System.out.println("Processed File: " + translateFileInput.filePathRelativeToInput
                            + " Time Taken: " + getDelta(startTime1, stopTime));

                    Date startTime2 = new Date();
                    translateFileInput.filePathRelativeToInput = filePathRelativeToInput;
                    translateFileInput.dryRun = false;
                    visitor.translateFile(translateFileInput);
                    stopTime = new Date();
                    System.out.println("Processed File: " + translateFileInput.filePathRelativeToInput
                            + " Time Taken: " + getDelta(startTime2, stopTime));
                } catch (Exception e) {
                    e.printStackTrace();
                    System.out.println("###########################Error Processing: " + filePathRelativeToInput
                            + ", Continuing with next set of tiles");
                } finally {
                    i += 2;
                }
                continue;
            }
            if (!isIgnoredFile(filePathRelativeToInput, exceptFiles))
                visitor.translateFile(translateFileInput);
            i++;
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("###########################Error Processing: " + filePathRelativeToInput
                    + ", Continuing with next set of tiles");
        } finally {
            Date stopTime = new Date();
            //                System.out.println("Processed File(s): " + filePathRelativeToInput.replaceAll(H_OR_M, "") + " Time Taken: " + getDelta(startTime, stopTime));
        }
    }
}

From source file:com.adobe.aem.demomachine.Json2Csv.java

public static void main(String[] args) throws IOException {

    String inputFile1 = null;/*w  w w  .  j  a  v a  2  s  . co  m*/
    String inputFile2 = null;
    String outputFile = null;

    HashMap<String, String> hmReportSuites = new HashMap<String, String>();

    // Command line options for this tool
    Options options = new Options();
    options.addOption("c", true, "Filename 1");
    options.addOption("r", true, "Filename 2");
    options.addOption("o", true, "Filename 3");
    CommandLineParser parser = new BasicParser();
    try {
        CommandLine cmd = parser.parse(options, args);

        if (cmd.hasOption("c")) {
            inputFile1 = cmd.getOptionValue("c");
        }

        if (cmd.hasOption("r")) {
            inputFile2 = cmd.getOptionValue("r");
        }

        if (cmd.hasOption("o")) {
            outputFile = cmd.getOptionValue("o");
        }

        if (inputFile1 == null || inputFile1 == null || outputFile == null) {
            System.exit(-1);
        }

    } catch (ParseException ex) {

        logger.error(ex.getMessage());

    }

    // List of customers and report suites for these customers
    String sInputFile1 = readFile(inputFile1, Charset.defaultCharset());
    sInputFile1 = sInputFile1.replaceAll("ObjectId\\(\"([0-9a-z]*)\"\\)", "\"$1\"");

    // Processing the list of report suites for each customer
    try {

        JSONArray jCustomers = new JSONArray(sInputFile1.trim());
        for (int i = 0, size = jCustomers.length(); i < size; i++) {
            JSONObject jCustomer = jCustomers.getJSONObject(i);
            Iterator<?> keys = jCustomer.keys();
            String companyName = null;
            while (keys.hasNext()) {
                String key = (String) keys.next();
                if (key.equals("company")) {
                    companyName = jCustomer.getString(key);
                }
            }
            keys = jCustomer.keys();
            while (keys.hasNext()) {
                String key = (String) keys.next();

                if (key.equals("report_suites")) {
                    JSONArray jReportSuites = jCustomer.getJSONArray(key);
                    for (int j = 0, rSize = jReportSuites.length(); j < rSize; j++) {
                        hmReportSuites.put(jReportSuites.getString(j), companyName);
                        System.out.println(jReportSuites.get(j) + " for company " + companyName);
                    }

                }
            }
        }

        // Creating the out put file
        PrintWriter writer = new PrintWriter(outputFile, "UTF-8");
        writer.println("\"" + "Customer" + "\",\"" + "ReportSuite ID" + "\",\"" + "Number of Documents"
                + "\",\"" + "Last Updated" + "\"");

        // Processing the list of SOLR collections
        String sInputFile2 = readFile(inputFile2, Charset.defaultCharset());
        sInputFile2 = sInputFile2.replaceAll("NumberLong\\(\"([0-9a-z]*)\"\\)", "\"$1\"");

        JSONObject jResults = new JSONObject(sInputFile2.trim());
        JSONArray jCollections = jResults.getJSONArray("result");
        for (int i = 0, size = jCollections.length(); i < size; i++) {
            JSONObject jCollection = jCollections.getJSONObject(i);
            String id = null;
            String number = null;
            String lastupdate = null;

            Iterator<?> keys = jCollection.keys();
            while (keys.hasNext()) {
                String key = (String) keys.next();
                if (key.equals("_id")) {
                    id = jCollection.getString(key);
                }
            }

            keys = jCollection.keys();
            while (keys.hasNext()) {
                String key = (String) keys.next();
                if (key.equals("noOfDocs")) {
                    number = jCollection.getString(key);
                }
            }

            keys = jCollection.keys();
            while (keys.hasNext()) {
                String key = (String) keys.next();
                if (key.equals("latestUpdateDate")) {
                    lastupdate = jCollection.getString(key);
                }
            }

            Date d = new Date(Long.parseLong(lastupdate));
            System.out.println(hmReportSuites.get(id) + "," + id + "," + number + "," + lastupdate + ","
                    + new SimpleDateFormat("MM-dd-yyyy").format(d));
            writer.println("\"" + hmReportSuites.get(id) + "\",\"" + id + "\",\"" + number + "\",\""
                    + new SimpleDateFormat("MM-dd-yyyy").format(d) + "\"");

        }

        writer.close();

    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:com.thoughtworks.xstream.tools.benchmark.parsers.ParserBenchmark.java

public static void main(String[] args) {
    int counter = 1000;

    Options options = new Options();
    options.addOption("p", "product", true, "Class name of the product to use for benchmark");
    options.addOption("n", true, "Number of repetitions");

    Harness harness = new Harness();
    harness.addMetric(new DeserializationSpeedMetric(0, false) {
        public String toString() {
            return "Initial run deserialization";
        }//www  .  j av a 2  s .  c  o  m
    });

    Parser parser = new PosixParser();
    try {
        CommandLine commandLine = parser.parse(options, args);
        String name = null;
        if (commandLine.hasOption('p')) {
            name = commandLine.getOptionValue('p');
        }
        if (name == null || name.equals("DOM")) {
            harness.addProduct(new XStreamDom());
        }
        if (name == null || name.equals("JDOM")) {
            harness.addProduct(new XStreamJDom());
        }
        if (name == null || name.equals("DOM4J")) {
            harness.addProduct(new XStreamDom4J());
        }
        if (name == null || name.equals("XOM")) {
            harness.addProduct(new XStreamXom());
        }
        if (name == null || name.equals("BEAStAX")) {
            harness.addProduct(new XStreamBEAStax());
        }
        if (name == null || name.equals("Woodstox")) {
            harness.addProduct(new XStreamWoodstox());
        }
        if (JVM.is16() && (name == null || name.equals("SJSXP"))) {
            harness.addProduct(new XStreamSjsxp());
        }
        if (name == null || name.equals("Xpp3")) {
            harness.addProduct(new XStreamXpp3());
        }
        if (name == null || name.equals("kXML2")) {
            harness.addProduct(new XStreamKXml2());
        }
        if (name == null || name.equals("Xpp3DOM")) {
            harness.addProduct(new XStreamXpp3DOM());
        }
        if (name == null || name.equals("kXML2DOM")) {
            harness.addProduct(new XStreamKXml2DOM());
        }
        if (commandLine.hasOption('n')) {
            counter = Integer.parseInt(commandLine.getOptionValue('n'));
        }
    } catch (ParseException e) {
        e.printStackTrace();
    }

    harness.addMetric(new DeserializationSpeedMetric(counter, false));
    harness.addTarget(new BasicTarget());
    harness.addTarget(new ExtendedTarget());
    harness.addTarget(new ReflectionTarget());
    harness.addTarget(new SerializableTarget());
    harness.addTarget(new JavaBeanTarget());
    if (false) {
        harness.addTarget(new FieldReflection());
        harness.addTarget(new HierarchyLevelReflection());
        harness.addTarget(new InnerClassesReflection());
        harness.addTarget(new StaticInnerClassesReflection());
    }
    harness.run(new TextReporter(new PrintWriter(System.out, true)));
    System.out.println("Done.");
}

From source file:TransactedChat.java

/** Main program entry point. */
public static void main(String argv[]) {

    // Is there anything to do?
    if (argv.length == 0) {
        printUsage();//from   w ww.  j  a  va  2  s. com
        System.exit(1);
    }

    // Values to be read from parameters
    String broker = DEFAULT_BROKER_NAME;
    String username = null;
    String password = DEFAULT_PASSWORD;

    // Check parameters
    for (int i = 0; i < argv.length; i++) {
        String arg = argv[i];

        if (arg.equals("-b")) {
            if (i == argv.length - 1 || argv[i + 1].startsWith("-")) {
                System.err.println("error: missing broker name:port");
                System.exit(1);
            }
            broker = argv[++i];
            continue;
        }

        if (arg.equals("-u")) {
            if (i == argv.length - 1 || argv[i + 1].startsWith("-")) {
                System.err.println("error: missing user name");
                System.exit(1);
            }
            username = argv[++i];
            continue;
        }

        if (arg.equals("-p")) {
            if (i == argv.length - 1 || argv[i + 1].startsWith("-")) {
                System.err.println("error: missing password");
                System.exit(1);
            }
            password = argv[++i];
            continue;
        }

        if (arg.equals("-h")) {
            printUsage();
            System.exit(1);
        }

        // Invalid argument
        System.err.println("error: unexpected argument: " + arg);
        printUsage();
        System.exit(1);
    }

    // Check values read in.
    if (username == null) {
        System.err.println("error: user name must be supplied");
        printUsage();
    }

    // Start the JMS client for the "chat".
    TransactedChat chat = new TransactedChat();
    chat.chatter(broker, username, password);

}

From source file:cz.incad.kramerius.virtualcollections.VirtualCollectionsManager.java

public static void main(String[] args) throws Exception {
    logger.log(Level.INFO, "process args: {0}", Arrays.toString(args));
    FedoraAccess fa = new FedoraAccessImpl(KConfiguration.getInstance(), null);
    String action = args[0];
    String pid = args[1];/*from  w ww  . j  a  v  a 2  s .  co m*/
    String collection = args[2];

    if (action.equals("remove")) {
        ProcessStarter.updateName("Remove " + pid + " from collection " + collection);
        CollectionUtils.removeFromCollection(pid, collection, fa);
        CollectionUtils.startIndexer(pid, "fromKrameriusModel", "Reindex doc " + pid);
    } else if (action.equals("add")) {
        ProcessStarter.updateName("Add " + pid + " to collection " + collection);
        CollectionUtils.addToCollection(pid, collection, fa);
        CollectionUtils.startIndexer(pid, "fromKrameriusModel", "Reindex doc " + pid);
    } else if (action.equals("removecollection")) {
        ProcessStarter.updateName("Remove collection " + collection);
        CollectionUtils.delete(collection, fa);
    } else {
        logger.log(Level.INFO, "Unsupported action: {0}", action);
        return;
    }

    logger.log(Level.INFO, "Finished");

}

From source file:PeerDiscovery.java

/**
 * @param args//from   w w w.ja  va2s. c  o  m
 */
public static void main(String[] args) {
    try {
        int group = 6969;

        PeerDiscovery mp = new PeerDiscovery(group, 6969);

        boolean stop = false;

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        while (!stop) {
            System.out.println("enter \"q\" to quit, or anything else to query peers");
            String s = br.readLine();

            if (s.equals("q")) {
                System.out.print("Closing down...");
                mp.disconnect();
                System.out.println(" done");
                stop = true;
            } else {
                System.out.println("Querying");

                Peer[] peers = mp.getPeers(100, (byte) 0);

                System.out.println(peers.length + " peers found");
                for (Peer p : peers) {
                    System.out.println("\t" + p);
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.linkedin.databus.eventgenerator.DataGenerator.java

public static void main(String[] args) throws IOException, UnknownTypeException {

    // load and verify the options
    CommandLineParser parser = new PosixParser();
    Options opts = loadOptions();/*w w  w  . j  a  v  a 2  s  .com*/

    CommandLine cmd = null;
    try {
        cmd = parser.parse(opts, args);
    } catch (org.apache.commons.cli.ParseException parseEx) {
        LOG.error("Invalid option");
        printHelp(opts);
        return;
    }

    if (cmd.hasOption('l')) {
        String log4jPropFile = cmd.getOptionValue('l');
        PropertyConfigurator.configure(log4jPropFile);
        LOG.info("Using custom logging settings from file " + log4jPropFile);
    } else {
        PatternLayout defaultLayout = new PatternLayout("%d{ISO8601} +%r [%t] (%p) {%c{1}} %m%n");
        ConsoleAppender defaultAppender = new ConsoleAppender(defaultLayout);

        Logger.getRootLogger().removeAllAppenders();
        Logger.getRootLogger().addAppender(defaultAppender);

        LOG.info("Using default logging settings");
    }

    // check for necessary options
    String fileLoc = cmd.getOptionValue("schemaLocation");
    if (fileLoc == null) {
        LOG.error("schemaLocation not specified");
        printHelp(opts);
    }

    //get string length and check if min is greater than 0

    // Generate the record
    File schemaFile = new File(fileLoc);
    DataGenerator dataGenerator = new DataGenerator(schemaFile);
    GenericRecord record = dataGenerator.generateRandomRecord();
    if (cmd.hasOption(PRINT_AVRO_JSON_OPTNAME)) {
        String outname = cmd.getOptionValue(PRINT_AVRO_JSON_OPTNAME);
        OutputStream outs = System.out;
        if (!outname.equals("-")) {
            outs = new FileOutputStream(outname);
        }
        printAvroJson(record, outs);
        if (!outname.equals("-")) {
            outs.close();
        }
    } else {
        DataGenerator.prettyPrint(record);
    }

}

From source file:gr.forth.ics.isl.preprocessfilter2.controller.Controller.java

public static void main(String[] args) throws XPathExpressionException, ParserConfigurationException,
        SAXException, IOException, PreprocessFilterException, TransformerException, ParseException {
    PropertyReader prop = new PropertyReader();

    //The following block of code is executed if there are arguments from the command line
    if (args.length > 0) {

        try {//from   w w w  .  j ava2s. c  o m
            Options options = new Options();
            CommandLineParser PARSER = new PosixParser();
            Option inputFile = new Option("inputFile", true, "input xml file");
            Option outputFile = new Option("outputFile", true, "output xml file");
            Option parentNode = new Option("parentNode", true, "output xml file");
            Option newValuesFile = new Option("newValuesFile", true, "new values xml file");
            Option newParentNode = new Option("newParentNode", true, "new parent node");
            Option newValueTag = new Option("newValueTag", true, "new value tag");
            Option oldValueTag = new Option("oldValueTag", true, "old value tag");
            Option sameValueTag = new Option("sameValueTag", true, "same value tag");
            Option createNewValues = new Option("createNewValues", true, "create new values option");
            options.addOption(inputFile).addOption(outputFile).addOption(parentNode).addOption(newValuesFile)
                    .addOption(newParentNode).addOption(newValueTag).addOption(oldValueTag)
                    .addOption(sameValueTag).addOption(createNewValues);
            CommandLine cli = PARSER.parse(options, args);
            String inputFileArg = cli.getOptionValue("inputFile");
            String outputFileArg = cli.getOptionValue("outputFile");
            String parentNodeArg = cli.getOptionValue("parentNode");
            String newValuesFileArg = cli.getOptionValue("newValuesFile");
            String newParentNodeArg = cli.getOptionValue("newParentNode");
            String newValueTagArg = cli.getOptionValue("newValueTag");
            String oldValueTagArg = cli.getOptionValue("oldValueTag");
            String sameValueTagArg = cli.getOptionValue("sameValueTag");
            String createNewValuesArg = cli.getOptionValue("createNewValues");
            PreprocessFilterUtilities process = new PreprocessFilterUtilities();
            if (createNewValuesArg.equals("yes")) {
                if (process.createNewValuesFile(inputFileArg, newValuesFileArg, parentNodeArg)) {
                    System.out.println("Succesfull PreProcessing!!!");
                }
            } else {
                if (process.createOutputFile(inputFileArg, outputFileArg, parentNodeArg, newParentNodeArg,
                        newValueTagArg, oldValueTagArg, sameValueTagArg, newValuesFileArg)) {
                    System.out.println("Succesfull PreProcessing!!!");
                }
            }
        } catch (PreprocessFilterException ex) {
            Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
            throw new PreprocessFilterException("PreProcess Filter Exception:", ex);
        }

    } //If there are no command line arguments then the .config file is being used.
    else {

        try {
            String inputFilePathProp = prop.getProperty(inputFilePath);
            String outputFilePathProp = prop.getProperty(outputFilePath);
            String parentNodeProp = prop.getProperty(parentNode);

            String newValuesFilePathProp = prop.getProperty(newValuesFilePath);
            String newParentNodeProp = prop.getProperty(newParentNode);
            String newValueTagProp = prop.getProperty(newValueTag);
            String oldValueTagProp = prop.getProperty(oldValueTag);
            String sameValueTagProp = prop.getProperty(sameValueTag);
            String createNewValuesFileProp = prop.getProperty(createNewValuesFile);

            PreprocessFilterUtilities process = new PreprocessFilterUtilities();

            //The filter's code is executed with the .config file's resources as parameters
            if (createNewValuesFileProp.equals("yes")) {
                process.createNewValuesFile(inputFilePathProp, newValuesFilePathProp, parentNodeProp);
            } else {
                process.createOutputFile(inputFilePathProp, outputFilePathProp, parentNodeProp,
                        newParentNodeProp, newValueTagProp, oldValueTagProp, sameValueTagProp,
                        newValuesFilePathProp);
            }
        } catch (PreprocessFilterException ex) {
            Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
            throw new PreprocessFilterException("PreProcess Filter Exception:", ex);
        }
    }

}

From source file:de.micromata.genome.tpsb.executor.GroovyShellExecutor.java

public static void main(String[] args) {
    String methodName = null;//from   w  ww  . ja v a2  s  .c  om
    if (args.length > 0 && StringUtils.isNotBlank(args[0])) {
        methodName = args[0];
    }
    GroovyShellExecutor exec = new GroovyShellExecutor();
    //System.out.println("GroovyShellExecutor start");
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String line;
    StringBuffer code = new StringBuffer();
    try {
        while ((line = in.readLine()) != null) {
            if (line.equals("--EOF--") == true) {
                break;
            }
            code.append(line);
            code.append("\n");

            //System.out.flush();
        }
    } catch (IOException ex) {
        throw new RuntimeException("Failure reading std in: " + ex.toString(), ex);
    }
    try {
        exec.executeCode(code.toString(), methodName);
    } catch (Throwable ex) { // NOSONAR "Illegal Catch" framework
        warn("GroovyShellExecutor failed with exception: " + ex.getClass().getName() + ": " + ex.getMessage()
                + "\n" + ExceptionUtils.getStackTrace(ex));
    }
    System.out.println("--EOP--");
    System.out.flush();
}

From source file:edu.msu.cme.rdp.seqmatch.cli.SeqMatchMain.java

public static void main(String[] args) throws Exception {

    if (args.length == 0) {
        System.err.println("USAGE: SeqMatchMain [train|seqmatch] <args>");
        return;/*  w  w w  .  jav a 2s .c  o  m*/
    }

    String cmd = args[0];
    args = Arrays.copyOfRange(args, 1, args.length);

    if (cmd.equals("train")) {
        if (args.length != 2) {
            System.err.println("USAGE: train <reference sequences> <trainee_out_file_prefix>"
                    + "\nMultiple trainee output files might be created, each containing maximum "
                    + Trainee.MAX_NUM_SEQ + " sequences");
            return;
        }

        File refSeqs = new File(args[0]);
        File traineeFileOut = new File(args[1]);

        //maybe more than 1 trainee files need to be created, depending on the number of seqs
        CreateMultiMatchFromFile.getMultiTrainee(refSeqs, traineeFileOut);
    } else if (cmd.equals("seqmatch")) {
        File refFile = null;
        File queryFile = null;
        HashMap<String, String> descMap = new HashMap<String, String>();
        PrintStream out = new PrintStream(System.out);
        int knn = 20;
        float minSab = .5f;

        try {
            CommandLine line = new PosixParser().parse(options, args);

            if (line.hasOption("knn")) {
                knn = Integer.parseInt(line.getOptionValue("knn"));
            }

            if (line.hasOption("sab")) {
                minSab = Float.parseFloat(line.getOptionValue("sab"));
            }
            if (line.hasOption("desc")) {
                descMap = readDesc(new File(line.getOptionValue("desc")));
            }
            if (line.hasOption("outFile")) {
                out = new PrintStream(new File(line.getOptionValue("outFile")));
            }

            args = line.getArgs();

            if (args.length != 2) {
                throw new Exception("Unexpected number of command line arguments");
            }

            refFile = new File(args[0]);
            queryFile = new File(args[1]);

        } catch (Exception e) {
            new HelpFormatter().printHelp("seqmatch <refseqs | trainee_file_or_dir> <query_file>\n"
                    + " trainee_file_or_dir is a single trainee file or a directory containing multiple trainee files",
                    options);
            System.err.println("Error: " + e.getMessage());
            return;
        }

        SeqMatch seqmatch = null;
        if (refFile.isDirectory()) { // a directory of trainee files
            List<SeqMatch> engineList = new ArrayList<SeqMatch>();
            for (File f : refFile.listFiles()) {
                if (!f.isHidden()) {
                    TwowaySeqMatch match = new TwowaySeqMatch(new SeqMatchEngine(new StorageTrainee(f)));
                    engineList.add(match);
                }
            }
            seqmatch = new MultiTraineeSeqMatch(engineList);
        } else { // a single fasta file or trainee file
            if (SeqUtils.guessFileFormat(refFile) == SequenceFormat.UNKNOWN) {
                seqmatch = CLISeqMatchFactory.trainTwowaySeqMatch(new StorageTrainee(refFile));
            } else {
                seqmatch = CreateMultiMatchFromFile.getMultiMatch(refFile);
            }
        }

        out.println("query name\tmatch seq\torientation\tS_ab score\tunique oligomers\tdescription");

        SeqReader reader = new SequenceReader(queryFile);
        Sequence seq;

        while ((seq = reader.readNextSequence()) != null) {
            SeqMatchResultSet resultSet = seqmatch.match(seq, knn);
            for (SeqMatchResult result : resultSet) {
                char r = '+';
                if (result.isReverse()) {
                    r = '-';
                }

                if (result.getScore() > minSab) {
                    out.println(seq.getSeqName() + "\t" + result.getSeqName() + "\t" + r + "\t"
                            + result.getScore() + "\t" + resultSet.getQueryWordCount() + "\t"
                            + descMap.get(result.getSeqName()));
                }
            }
        }

        out.close();
    } else {
        throw new IllegalArgumentException("USAGE: SeqMatchMain [train|seqmatch] <args>");
    }
}