mas01mj@728: package examples; mas01mj@728: mas01mj@728: import org.omras2.*; mas01mj@728: import java.io.File; mas01mj@728: import java.util.Vector; mas01mj@728: mas01mj@728: public class Simple mas01mj@728: { mas01mj@728: public static void main(String args[]) mas01mj@728: { mas01mj@728: AudioDB testDB = new AudioDB(new File("simple.adb")); mas01mj@728: testDB.create(5, 5, 5); mas01mj@728: testDB.open(AudioDB.Mode.O_RDWR); mas01mj@728: System.out.println("Inserting 3 features"); mas01mj@728: testDB.insert("feature1", 2, 5, new double[] { 6, 7, 8, 9, 10, 1, 2, 3, 4, 5 }); mas01mj@728: testDB.insert("feature2", 1, 5, new double[] { 6, 7, 8, 9, 10 }); mas01mj@728: testDB.insert("feature3", 5, 5, new double[] { 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 4, 4, 4, 4, 4, 5, 5, 5, 9, 10, 1, 2, 3, 4, 5 , 4, 4, 4, 4, 4}); mas01mj@728: mas01mj@728: System.out.println("Performing query"); mas01mj@728: Query query = new Query(); mas01mj@728: query.setSeqLength(1); mas01mj@728: query.setSeqStart(0); mas01mj@728: Vector results = testDB.query("feature1", query); mas01mj@728: mas01mj@728: System.out.println("Results:"); mas01mj@728: for(Result result: results) mas01mj@728: { mas01mj@728: System.out.println(result.getKey()+" "+result.getDistance()+" "+result.getIpos()+" "+result.getQpos()); mas01mj@728: } mas01mj@728: } mas01mj@728: }