/**/ // import mp3project.*; public class MP3Checker { public static void main(String argv[]) { try { DB testDB = new DB("mp3."+argv[0]); /* Fill the DB: testDB */ testDB.addSong(new Song("Walking on the Moon", "Police, The", "Every Breath You Take", 4, 2003, "Pop")); testDB.addSong(new Song("Sex Crime", "Eurythmics", "1984 for the Love of the Big Brother", 2, 1984, "Rock")); testDB.addSong(new Song("With or Without You", "U2", "The Joshua Tree", 3, 1987, "Rock")); testDB.addSong(new Song("Exit", "U2", "The JOSHUA TrEe", 10, 1987, "Rock")); testDB.addSong(new Song("Moonlight Shadow", "Oldfield, Mike", "Crises", 2, 1982, "Ambient")); testDB.addSong(new Song("I'm on Fire", "Springsteen, Bruce", "Born in the U.S.A.", 6, 1984, "Rock")); /* Write the DB: testDB on the screen */ System.out.println("DB: originale\n"+testDB); /* Back-up it in mp3b+... */ testDB.backup("mp3b."+argv[0]); /* Clone the DB: testDB in tmp */ DB tmp = (DB)testDB.clone(); /* U2WithOrWithoutYou will be put inside the DBs several times */ Song U2WithOrWithoutYou = new Song("wITH or Without You", "U2", "The Joshua Tree", 12, 1987, "Rock"); /* Fill the DB: tmp */ tmp.addSong(U2WithOrWithoutYou); tmp.capitalizeTitles(); tmp.addSong(new Song("What Have I Done to Deserve This?", "Pet Shop Boys", "PopArt: POP (CD1)", 4, 2003, "Lo-Fi")); /* After capitalization it prints DB: tmp on the screen */ System.out.println("DB2: copia capitalized\n"+tmp); /* Squeeze spaces out of the copy */ testDB.write(); tmp.squeezeSpaces(); System.out.println("DB2: copia ripulita\n"+tmp); tmp.reload(); System.out.println("DB2: copia dopo reload\n"+tmp); testDB.addSong(new Song("I Wouldn't Normally Do This Kind of Thing", "Pet Shop Boys", "PopArt: POP (CD1)", 6, 2003, "Lo-Fi")); testDB.addSong(new Song("Diavolo In Me - A Devil in Me (with Solomon Burke)", "Zucchero", "[2004] Zu & Co", 15, 2004, "Rock")); testDB.addSong(U2WithOrWithoutYou); testDB.addSong(new Song("Advice For The Young At Heart", "Tear for Fears", "Tears Roll Down (Greatest Hits 82-92)", 12, 1992, "Pop")); testDB.addSong(new Song("Sowing The Seeds Of Love", "Tear for Fears", "Tears Roll Down (Greatest Hits 82-92)", 01, 1992, "Pop")); testDB.addSong(U2WithOrWithoutYou); tmp = (DB)testDB.clone(); /* Squeeze the DB: testDB */ System.out.println("DB: originale e cloned né squeezed né ripulito\n"+testDB); testDB.squeeze(); System.out.println("DB: originale squeezed\n"+testDB); /* Remove "With or Without You" from tmp */ tmp.removeSong(U2WithOrWithoutYou); System.out.println("DB: cloned senza \"With or Without You\"\n"+tmp); /* Sort the DB: testDB */ testDB.sort(); System.out.println("DB: originale ordinato\n"+testDB); testDB.write(); /* Look for a String */ Query q = new TitleSubstringQuery("moon"); System.out.println("DB: risultato della query con \"moon\"\n"); Song[] ss = testDB.query(q); for(int z=0; z