From 1d8ff377617c16d88649e7d18ee76c12ae104c45 Mon Sep 17 00:00:00 2001 From: jihoonl Date: Mon, 2 Nov 2009 05:26:15 +0000 Subject: [PATCH] changes --- .../Distributed/SpamFilter/Mail.java | 60 ++++++++++--------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/Robust/src/Benchmarks/Distributed/SpamFilter/Mail.java b/Robust/src/Benchmarks/Distributed/SpamFilter/Mail.java index ffb84ffb..61fee691 100644 --- a/Robust/src/Benchmarks/Distributed/SpamFilter/Mail.java +++ b/Robust/src/Benchmarks/Distributed/SpamFilter/Mail.java @@ -14,7 +14,7 @@ public class Mail { String noURLBody; String sourceCode; boolean hasAttachement; - //String encoding; //rich text, plain, html + String encoding; //rich text, plain, html String messageID; // cached message ID for reuse (takes a lot of memory and is used all over the place) //same as hashcode of a class @@ -31,26 +31,26 @@ public class Mail { while((line = fileinput.readLine()) != null) { - String[] splittedLine = line.split(); - if(splittedLine[0].equals("Header:")) // message id + Vector splittedLine = line.split(); + if(((String)(splittedLine.elementAt(0))).equals("Header:")) // message id { - header = splittedLine[1]; + header = (String)splittedLine.elementAt(1); } - else if(splittedLine[0].equals("To:")) // receiver + else if(((String)(splittedLine.elementAt(0))).equals("To:")) // receiver { - to = splittedLine[1]; + to = (String)splittedLine.elementAt(1); } - else if(splittedLine[0].equals("From:")) // sender + else if(((String)(splittedLine.elementAt(0))).equals("From:")) // sender { - from = splittedLine[1]; + from = (String)splittedLine.elementAt(1); } - else if(splittedLine[0].equals("Cc:")) // cc + else if(((String)(splittedLine.elementAt(0))).equals("Cc:")) // cc { - cc = splittedLine[1]; + cc = (String)splittedLine.elementAt(1); } - else if(splittedLine[0].equals("Title:")) // Subject + else if(((String)(splittedLine.elementAt(0))).equals("Title:")) // Subject { - subject = splittedLine[1]; + subject = (String)splittedLine.elementAt(1); break; } } // parsed messageID, To, from, cc, Title @@ -73,7 +73,7 @@ public class Mail { return header; } - /* + public void setSentOn(String sentOn) { this.sentOn = sentOn; } @@ -99,7 +99,7 @@ public class Mail { String receivedOn = getReceivedOn(); return parseDate(receivedOn); } - */ + /** * Parses a given Date-String in into a real Date-Object @@ -234,8 +234,8 @@ public class Mail { return false; } */ - - public Vector createMailStringsWithURL() + + public Vector getCommonPart() { Vector returnStrings = new Vector(); @@ -244,13 +244,24 @@ public class Mail { returnStrings.addElement(from); returnStrings.addElement(subject); - String[] splittedBody = body.split(); + return returnStrings; + } + + public String getBodyString() + { + return body; + } + + + public Vector getURLs() + { + Vector returnStrings = new Vector(); + Vector splittedBody = body.split(); // add URL and email in the body - for(int i=0; i