package edu.rice.hj.example.comp322.assignments.hw3; import java.io.BufferedReader; import java.io.FileReader; /** * COMP 322 S13 *

* This file is a template for your UsefulParScoring implementation. You may add * anything to it that you like, but please do not modify the main() function as * declared, though you may add your own code below the existing template. */ public class UsefulParScoring { public static String initString(final String fname) throws java.io.IOException { final BufferedReader r = new BufferedReader(new FileReader(fname)); final StringBuilder text = new StringBuilder(); String line; while ((line = r.readLine()) != null) { text.append(line); } return text.toString(); } /** * This program takes as input two sequences, passed as the only two * command line arguments, seq1 and seq2 */ public static void main(final String[] args) throws java.io.IOException { if (args.length != 2) { System.out.println("usage: java UsefulParScoring file1 file2"); return; } final String filename1 = args[0]; final String filename2 = args[1]; final String seq1 = initString(filename1); final String seq2 = initString(filename2); System.out.println("Processing sequences \"" + seq1.substring(0, seq1.length() < 5 ? seq1.length() : 5) + (seq1.length() > 5 ? "..." : "") + "\" and \"" + seq2.substring(0, seq2.length() < 5 ? seq2.length() : 5) + (seq2.length() > 5 ? "...\"" : "\"")); // ... } }