Exemple #1
0
 private int getValue(List<StepValue<Integer>> list, int step) {
   Integer value = BDXUtil.getValueWithStep(list, step, true);
   if (value == null) {
     return 0;
   }
   return value;
 }
Exemple #2
0
 public List<Chord> getChordSet(int step) {
   if (_type != InstrumentType.GUITAR && _type != InstrumentType.PIANO) {
     throw new IllegalStateException();
   }
   List<Chord> chordSet = BDXUtil.getValueWithStep(_chordSetList, step, true);
   if (chordSet == null) {
     return Collections.emptyList();
   }
   return chordSet;
 }
Exemple #3
0
 public void addChord(int step, Chord c) {
   if (_type != InstrumentType.GUITAR && _type != InstrumentType.PIANO) {
     throw new IllegalStateException();
   }
   int index = BDXUtil.searchIndexWithStep(_chordSetList, step, true);
   if (index < 0) {
     List<Chord> chordSet = new ArrayList<Chord>();
     chordSet.add(c);
     addChordSet(step, chordSet);
     return;
   }
   StepValue<List<Chord>> sv = _chordSetList.get(index);
   int st = sv.getStep();
   if (st == step) {
     List<Chord> chordSet = sv.getValue();
     chordSet.add(c);
   } else {
     List<Chord> chordSet = new ArrayList<Chord>();
     chordSet.add(c);
     addChordSet(step, chordSet);
     Collections.sort(_chordSetList, StepValue.STEP_COMPARATOR);
   }
 }
Exemple #4
0
 public Clef getClef(int step) {
   if (_type != InstrumentType.SINGLE) {
     throw new IllegalStateException();
   }
   return BDXUtil.getValueWithStep(_clef, step, true);
 }
Exemple #5
0
 public Voicing getVoicing(int step) {
   if (_type != InstrumentType.PIANO) {
     throw new IllegalStateException();
   }
   return BDXUtil.getValueWithStep(_voicing, step, true);
 }