From 33e003da7005eb41d133473752dae867354e31f1 Mon Sep 17 00:00:00 2001 From: adash Date: Thu, 22 Apr 2010 01:22:04 +0000 Subject: [PATCH] changes to webpage generator --- .../recovery/gendata/GenerateWebFile.java | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/Robust/src/Benchmarks/Recovery/Spider/recovery/gendata/GenerateWebFile.java b/Robust/src/Benchmarks/Recovery/Spider/recovery/gendata/GenerateWebFile.java index c816effc..f263c443 100644 --- a/Robust/src/Benchmarks/Recovery/Spider/recovery/gendata/GenerateWebFile.java +++ b/Robust/src/Benchmarks/Recovery/Spider/recovery/gendata/GenerateWebFile.java @@ -13,49 +13,38 @@ public class GenerateWebFile { public static void main(String[] args) { int numFiles = 3000; int numLinks = 10; - String filename = "sourceFile.txt"; GenerateWebFile gwf = new GenerateWebFile(); gwf.wordList = gwf.fileToVector("wordList"); for(int i = 0; i < 3000; i++) { - Random rword = new Random(); - String title = gwf.genTitle(gwf.wordList, rword, filename); - String body = gwf.createBody(numLinks); + Random rword = new Random(i); + String title = gwf.genTitle(gwf.wordList, rword); + String body = gwf.createBody(numLinks, rword); //System.out.println("\n\nPassed create Body\n\n"); gwf.createFile(title, i, body); //System.out.println("\n\nPassed create File\n\n"); } } - public String genTitle(Vector v, Random rword, String filename) { + public String genTitle(Vector v, Random rword) { String title = ""; title = ""; //Randomly pick 5 words to generate Title + title += v.elementAt(rword.nextInt(8000)); for(int i=0; i<5; i++) { - title += v.elementAt(rword.nextInt(8000)); title += " "; - } - newfile = new File(filename); - try { - BufferedWriter out = new BufferedWriter(new FileWriter("sourceFile.txt", true)); - out.write(title + ":" + rword.nextInt(3000)); - out.newLine(); - out.flush(); - out.close(); - } catch (IOException e) { + title += v.elementAt(rword.nextInt(8000)); } return title; } - public String createBody(int numlinkinBody) { + public String createBody(int numlinkinBody, Random rword) { String body = ""; String hostname = null; - - Random rword = new Random(200); int nextRandomWord; for(int i = 0; i< numlinkinBody; i++) { nextRandomWord = rword.nextInt(3000); hostname = "dc-11.calit2.uci.edu"; - body += "XXXXX
" + "\n"; + body += "XXXXX
" + "\n"; } return body; } @@ -67,9 +56,9 @@ public class GenerateWebFile { BufferedWriter out = new BufferedWriter(new FileWriter(index+".html", true)); out.write(""); out.write(""); - out.write(""); - out.write(title); - out.write(""); + out.write(""+title+""); + //out.write(title); + //out.write(""); out.write(""); out.write(""); out.write("Filling in body
"); -- 2.34.1