/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package phonetalks;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.PriorityQueue;
import phonetalks.entities.calls.PhoneCall;
import phonetalks.entities.calls.SubscriberCallPair;
import phonetalks.entities.collections.CardIndex;
import phonetalks.entities.subscriber.Subscriber;
import phonetalks.entities.subscriber.SubscriberEntry;
import phonetalks.io.BinaryFileIndexSaver;
/**
*
* @author Платон
*/
public class Test {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
BinaryFileIndexSaver saver = new BinaryFileIndexSaver("out.bin", "writehere.bin");
CardIndex index2 = saver.readIndex();
PhoneCall call1 = new PhoneCall("777", 1, new GregorianCalendar(1999, 1, 1));
PhoneCall call2 = new PhoneCall("142", 2, new GregorianCalendar(2011, 1, 1));
PhoneCall call3 = new PhoneCall("777", 3, new GregorianCalendar(4555, 1, 1));
index2.addCall("3300052", call3);
index2.addCall("7555909", call2);
index2.addCall("3494090", call1);
for (Subscriber s : index2.keySet()) {
PriorityQueue<SubscriberEntry> col = index2.get(s);
for (SubscriberEntry se : col) {
System.out.println(se.toString());
}
}
ArrayList<SubscriberCallPair> al;
al = index2.getAllCalls("777");
for (SubscriberCallPair callPair : al) {
System.out.println(callPair.toString());
}
saver.writeIndex(index2);
}
}