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; }
public boolean remove(Harmony e) { for (int i = 0; i < e.getSize(); i++) { musicians[i].remove(e.getNote(i)); } super.remove(e); return true; }