package audio; import java.util.ArrayList; import java.util.List; public class SongInstance { private String difficulty; private List objects; private List buttons; public SongInstance(String difficulty) { this.difficulty = difficulty; objects = new ArrayList(); buttons = new ArrayList(); } public void addObjectInstance(ObjectInstance obj) { objects.add(obj); } public void addButtonInstance(ButtonInstance btn) { buttons.add(btn); } public List getObjects() { return objects; } public List getButtons() { return buttons; } public String getDifficulty() { return difficulty; } public void setDifficulty(String difficulty) { this.difficulty = difficulty; } public List getObjectsBetween(long oldProgress, long progress) { List b = new ArrayList(); for(ObjectInstance i : objects) { if(i.getTime() >= progress) { return b; } if(i.getTime() >= oldProgress && i.getTime() < progress) { b.add(i); } } return b; } public long getEndTime() { return objects.get(objects.size()-1).getTime(); } public List getButtonsBetween(long oldProgress, long progress) { List b = new ArrayList(); for(ButtonInstance i : buttons) { if(i.getTime() > progress) { return b; } if(i.getTime() >= oldProgress && i.getTime() < progress) { b.add(i); } } return b; } }