daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**This function sets a musician's Orchestra Section.
  2.  @param section  is a SymphonySection indicating the musician's Orchestra Section.*/
  3.  
  4.  public void setSection(SymphonySection section) {
  5.     this.section = section;
  6.  
  7.     if (getSection().toString().equals( "Strings" )){
  8.         Strings--;
  9.     }
  10.     else if (getSection().toString().equals( "Brass" )){
  11.         Brass--;
  12.     }
  13.     else if (getSection().toString().equals( "Conductor" )){
  14.         Conductor--;
  15.     }
  16.     else if (getSection().toString().equals( "Percussion" )){
  17.         Percussion--;
  18.     }
  19.     else if (getSection().toString().equals( "WoodWinds" )){
  20.         WoodWinds--;
  21.     }
  22.  
  23.     if (section.toString().equals( "Strings" )){
  24.         Strings++;
  25.     }
  26.     else if (section.toString().equals( "Brass" )){
  27.         Brass ++;
  28.     }
  29.     else if (section.toString().equals( "Conductor" )){
  30.         Conductor ++;
  31.     }
  32.     else if (section.toString().equals( "Percussion" )){
  33.         Percussion ++;
  34.     }
  35.     else if (section.toString().equals( "WoodWinds" )){
  36.         WoodWinds ++;
  37.     }
  38.  
  39. }
  40.    
  41. private final Map<SymphonySection, Integer> count = new HashMap<>();
  42. public void setSection(SymphonySection section) {
  43.     if(section == this.section) return;
  44.  
  45.     count.put(this.section, count.get(this.section)-1);
  46.     Integer prevCount = count.get(section)
  47.     count.put(section, prevCount == null ? 1 : (prevCount+1));
  48.  
  49.     this.section = section;
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top