Mercurial > hg > audiodb
comparison bindings/java/examples/Simple.java @ 728:d3407d1e2f57
* Initial insertion from data code
* Added some tests for insertion
* Added a simple example
author | mas01mj |
---|---|
date | Mon, 26 Jul 2010 16:19:56 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
727:4d9e4ff0a9cd | 728:d3407d1e2f57 |
---|---|
1 package examples; | |
2 | |
3 import org.omras2.*; | |
4 import java.io.File; | |
5 import java.util.Vector; | |
6 | |
7 public class Simple | |
8 { | |
9 public static void main(String args[]) | |
10 { | |
11 AudioDB testDB = new AudioDB(new File("simple.adb")); | |
12 testDB.create(5, 5, 5); | |
13 testDB.open(AudioDB.Mode.O_RDWR); | |
14 System.out.println("Inserting 3 features"); | |
15 testDB.insert("feature1", 2, 5, new double[] { 6, 7, 8, 9, 10, 1, 2, 3, 4, 5 }); | |
16 testDB.insert("feature2", 1, 5, new double[] { 6, 7, 8, 9, 10 }); | |
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}); | |
18 | |
19 System.out.println("Performing query"); | |
20 Query query = new Query(); | |
21 query.setSeqLength(1); | |
22 query.setSeqStart(0); | |
23 Vector<Result> results = testDB.query("feature1", query); | |
24 | |
25 System.out.println("Results:"); | |
26 for(Result result: results) | |
27 { | |
28 System.out.println(result.getKey()+" "+result.getDistance()+" "+result.getIpos()+" "+result.getQpos()); | |
29 } | |
30 } | |
31 } |