Exemplo n.º 1
0
 public boolean add(Harmony e) {
   if (contains(e)) {
     return false;
   } else if (size() < HMS) {
     for (int i = 0; i < e.getSize(); i++) musicians[i].add(e.getNote(i));
     super.add(e);
     return true;
   } else if (comparator.compare(e, worst()) > 0) {
     for (int i = 0; i < e.getSize(); i++) musicians[i].replace(worst().getNote(i), e.getNote(i));
     super.remove(worst());
     super.add(e);
     return true;
   }
   return false;
 }
Exemplo n.º 2
0
 public boolean remove(Harmony e) {
   for (int i = 0; i < e.getSize(); i++) {
     musicians[i].remove(e.getNote(i));
   }
   super.remove(e);
   return true;
 }