mas01mj@728
|
1 package examples;
|
mas01mj@728
|
2
|
mas01mj@728
|
3 import org.omras2.*;
|
mas01mj@728
|
4 import java.io.File;
|
mas01mj@728
|
5 import java.util.Vector;
|
mas01mj@728
|
6
|
mas01mj@728
|
7 public class Simple
|
mas01mj@728
|
8 {
|
mas01mj@728
|
9 public static void main(String args[])
|
mas01mj@728
|
10 {
|
mas01mj@728
|
11 AudioDB testDB = new AudioDB(new File("simple.adb"));
|
mas01mj@728
|
12 testDB.create(5, 5, 5);
|
mas01mj@728
|
13 testDB.open(AudioDB.Mode.O_RDWR);
|
mas01mj@728
|
14 System.out.println("Inserting 3 features");
|
mas01mj@728
|
15 testDB.insert("feature1", 2, 5, new double[] { 6, 7, 8, 9, 10, 1, 2, 3, 4, 5 });
|
mas01mj@728
|
16 testDB.insert("feature2", 1, 5, new double[] { 6, 7, 8, 9, 10 });
|
mas01mj@728
|
17 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
|
18
|
mas01mj@728
|
19 System.out.println("Performing query");
|
mas01mj@728
|
20 Query query = new Query();
|
mas01mj@728
|
21 query.setSeqLength(1);
|
mas01mj@728
|
22 query.setSeqStart(0);
|
mas01mj@728
|
23 Vector<Result> results = testDB.query("feature1", query);
|
mas01mj@728
|
24
|
mas01mj@728
|
25 System.out.println("Results:");
|
mas01mj@728
|
26 for(Result result: results)
|
mas01mj@728
|
27 {
|
mas01mj@728
|
28 System.out.println(result.getKey()+" "+result.getDistance()+" "+result.getIpos()+" "+result.getQpos());
|
mas01mj@728
|
29 }
|
mas01mj@728
|
30 }
|
mas01mj@728
|
31 }
|