29.07.2013 Views

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

{<br />

//Performance variables<br />

private final int initialVectorSize = 10;<br />

private final int incrementVectorSize = 10;<br />

//When was the list updated<br />

private long lastUpdate;<br />

public Vector elements;<br />

public Blacklist(Vector list)<br />

{<br />

elements = list;<br />

updatedList();<br />

}<br />

public Blacklist()<br />

{<br />

elements = new Vector(initialVectorSize,incrementVectorSize);<br />

}<br />

public Blacklist(int initialSize)<br />

{<br />

elements = new Vector(initialSize,incrementVectorSize);<br />

}<br />

public void merge(Blacklist b)<br />

{<br />

Enumeration e = b.elements.elements();<br />

while(e.hasMoreElements())<br />

{<br />

add((Certificate)e.nextElement());<br />

}<br />

updatedList();<br />

}<br />

public void add(Certificate cert)<br />

{<br />

if(!onBlacklist(cert))<br />

elements.addElement(cert);<br />

}<br />

public void remove(Certificate cert)<br />

{<br />

elements.removeElement(cert);<br />

}<br />

public boolean onBlacklist(Certificate cert)<br />

{<br />

return elements.contains(cert);<br />

}<br />

public Blacklist getFromIndex(int index)<br />

{<br />

//Blacklist copy = new Blacklist(elements.size()-index);<br />

//Enumeration e = elements.elements();<br />

//while(e.hasMoreElements())<br />

//{<br />

// copy.add((Certificate)e.nextElement());<br />

//}<br />

//return new Blacklist((Vector)elements.subList(index,elements.size()));<br />

}<br />

return this;<br />

private void updatedList()<br />

{<br />

lastUpdate = System.currentTimeMillis();<br />

}<br />

336

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!