FA/TransformerTest

From ggc

Jump to: navigation, search

01 package FA;
02 //start auto-imports
03 import java.util.*;
04 //end auto-imports
05 import wiki.Wiki;
06 
07 
08 /**
09  *     This program rquests console entry of two file names; one for the 
10  * sourece of text in which replacements will be made and the other file
11  * is the pairs of targets and replacements for the targets.
12  *   The program then calls methods from the FileTransformer class that
13  * reads the files and returns the transformed text.
14  @author Frank Anderson   */
15 public class TransformerTest
16 {
17 
18   public static void main(String[] args)
19   {
20     /** sourceFile is the name of the file containing text. */
21     String sourceFile="sf";
22     /** targetsFile is the name of the file containing text to be replaced and
23       * the text with which it will be replaced. */
24     String targetsFile="tf";
25     Scanner scanner = new Scanner(System.in);
26 
27 
28 
29     System.out.println("Enter the name of the source file for text.");
30     sourceFile = scanner.next();
31     System.out.println(sourceFile);
32     System.out.println("Enter the name of the file containing the replacements.");
33     targetsFile=scanner.next();
34 
35     System.out.println(targetsFile);
36 
37     System.out.println();
38     System.out.println();
39     System.out.println("The modified text is below:");
40     System.out.println();
41 
42     FileTransformer model = new FileTransformer();
43     model.setSourceFile(sourceFile);
44     //model.setSourceFile("SampleText.txt");
45     model.addReplacements(targetsFile);
46     //model.addReplacements("SampleReplacements.txt");
47     System.out.println(model.getTransformedText());
48   }
49 }


Download/View FA/TransformerTest.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter