Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class VocTest
- {
- public static void main(String args[])
- {
- System.out.println("### Voc Tester ###\n");
- System.out.println("# Creating new voc...");
- Voc vb = new Voc();
- System.out.println("# Is the voc empty...? "+ vb.isEmpty());
- System.out.println("# Here's voc representation:");
- System.out.println(vb.toString());
- System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
- System.out.println("# Done !\n");
- System.out.println("# Add 00aa->apple...");
- vb.insertTuple("00aa","apple");
- System.out.println("# Here is the voc representation:");
- System.out.println(vb.toString());
- System.out.println("# Is the voc empty...? "+ vb.isEmpty());
- System.out.println("# Is key '00aa' in...? "+ vb.isIn("00aa"));
- System.out.println("# Is key '99zz' in...? "+ vb.isIn("99zz"));
- System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
- System.out.println("# Done !\n");
- System.out.println("# Add some Tuples...");
- vb.insertTuple("22xw","strawberry");
- vb.insertTuple("32fr","santana");
- vb.insertTuple("98io","programmazione2");
- vb.insertTuple("21cd","tagomago");
- vb.insertTuple("52wb","pinkfloyd");
- vb.insertTuple("95hj","sole");
- vb.insertTuple("32po","luna");
- vb.insertTuple("78kk","spillo");
- vb.insertTuple("34fi","tequila");
- vb.insertTuple("84zl","patagonia");
- System.out.println("# Here's the voc representation:");
- System.out.println(vb.toString());
- System.out.println("# Is the voc empty...? "+ vb.isEmpty());
- System.out.println("# Is key '52wb' in...? "+ vb.isIn("52wb"));
- System.out.println("# So gimme the value...! "+ vb.searchTuple("52wb"));
- System.out.println("# Is key '99zz' in...? "+ vb.isIn("99zz"));
- System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
- System.out.println("# Done !\n");
- System.out.println("# Add 34fi->whiterussian... (refresh test)");
- System.out.println("# Here's the old voc representation:");
- System.out.println(vb.toString());
- System.out.println("# Gimme the old value...! "+ vb.searchTuple("34fi"));
- vb.insertTuple("34fi","whiterussian");
- System.out.println("# Here's the nu voc representation:");
- System.out.println(vb.toString());
- System.out.println("# So gimme the nu value...! "+ vb.searchTuple("34fi"));
- System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
- System.out.println("# Done !\n");
- System.out.println("# Remove some Tuples...");
- vb.removeTuple("22xw");
- vb.removeTuple("32fr");
- vb.removeTuple("00aa");
- vb.removeTuple("95hj");
- vb.removeTuple("34fi");
- System.out.println("# Here's the voc representation:");
- System.out.println(vb.toString());
- System.out.println("# Is the voc empty...? "+ vb.isEmpty());
- System.out.println("# Is key '52wb' in...? "+ vb.isIn("52wb"));
- System.out.println("# So gimme the value...! "+ vb.searchTuple("52wb"));
- System.out.println("# Is key '22xw' in...? "+ vb.isIn("22xw"));
- System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
- System.out.println("# Done !\n");
- System.out.println("# Seeya! :)");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement