Melody melody = new Melody();
melody.setId(result.getLong("system_id"));
String sequence = result.getString("sequence");
StringTokenizer tokenizer = new StringTokenizer(sequence, " ", false);
while (tokenizer.hasMoreElements()) {
Note note = new Note();
try {
note.setNote((new Integer((String) tokenizer.nextElement())).intValue());
note.setOffset((new Integer((String) tokenizer.nextElement())).intValue());
note.setDuration((new Integer((String) tokenizer.nextElement())).intValue());
note.setVelocity((new Integer((String) tokenizer.nextElement())).intValue());
} catch (Exception ex) {
ex.printStackTrace();
}
melody.addNote(note);
}