예제 #1
0
  void RemoveSuggestion(String babyName) {

    // Dummy value for genderSuitability
    Name name = new Name(babyName, 0);
    avlMale.delete(name);
    avlFemale.delete(name);
  }
예제 #2
0
  void AddSuggestion(String babyName, int genderSuitability) {

    Name name = new Name(babyName, genderSuitability);
    if (genderSuitability == 1) {
      avlMale.insert(name);
    } else { // Assume genderSuitability == 2
      avlFemale.insert(name);
    }
    // --------------------------------------------
  }
예제 #3
0
  int Query(String START, String END, int genderPreference) {

    if (genderPreference == 1) {
      return avlMale.lesserThan(END) - avlMale.lesserThan(START);
    } else if (genderPreference == 2) {
      return avlFemale.lesserThan(END) - avlFemale.lesserThan(START);
    } else { // Last case genderPreference == 0
      return (avlMale.lesserThan(END) - avlMale.lesserThan(START))
          + (avlFemale.lesserThan(END) - avlFemale.lesserThan(START));
    }
  }