com.googlecode.refit.eg.music.MusicLibrary Maven / Gradle / Ivy
// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Read license.txt in this directory.
package com.googlecode.refit.eg.music;
import java.io.*;
import java.util.*;
public class MusicLibrary {
static Music looking = null;
static Music library[] = {};
static void load(String name) throws Exception {
List music = new ArrayList();
File file = new File(System.getProperty("fit.inputDir"), name);
BufferedReader in = new BufferedReader(new FileReader(file));
in.readLine(); // skip column headings
while(in.ready()) {
music.add(Music.parse(in.readLine()));
}
in.close();
library = music.toArray(library);
}
static void select(Music m) {
looking = m;
}
static void search(double seconds){
Music.status = "searching";
Simulator.nextSearchComplete = Simulator.schedule(seconds);
}
static void searchComplete() {
Music.status = MusicPlayer.playing == null ? "ready" : "playing";
}
static void findAll() {
search(3.2);
for (int i=0; i