PDA

View Full Version : word occurrences



Alpdog14
03-18-2010, 07:29 PM
I have posted this in other forums and I am just trying to get the best help I can. I have a word occurrence project I have been stuck on. The pre-written test for the methods are not working so I was wondering if anyone can guide me the right direction. here is what i have and the test that is suppose to pass.


@Override
public void add(final String word, final int line) {
// TODO your job


add(word,line);
}

public boolean containsKey (String word, int line){
if(word == null){
return false;
}
return true;
}

/*
* (non-Javadoc)
*
* @see edu.luc.cs.laufer.index.Index#frequency(java.lang.String)
*/
@Override
public int frequency(final String word) {
// TODO your job
return -1;
}

Test:


@Test
public void testAdd() {
int s = index.containsKey("xyz") ? index.get("xyz").size() : 0;
index.add("xyz", 5);
assertTrue(index.get("xyz").contains(5));
assertEquals(s + 1, index.get("xyz").size());
}

Any help would be most appreciated.