Advertisement
Fhernd

GuitarSpec.java

Jun 10th, 2012
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1.  
  2. public class GuitarSpec {
  3.  
  4.   private Builder builder;
  5.   private String model;
  6.   private Type type;
  7.   private Wood backWood;
  8.   private Wood topWood;
  9.   private int numStrings;
  10.  
  11.   public GuitarSpec(Builder builder, String model, Type type,
  12.                     Wood backWood, Wood topWood, int numStrings ) {
  13.     this.builder = builder;
  14.     this.model = model;
  15.     this.type = type;
  16.     this.backWood = backWood;
  17.     this.topWood = topWood;
  18.     this.numStrings = numStrings;
  19.   }
  20.  
  21.   public Builder getBuilder() {
  22.     return builder;
  23.   }
  24.  
  25.   public String getModel() {
  26.     return model;
  27.   }
  28.  
  29.   public Type getType() {
  30.     return type;
  31.   }
  32.  
  33.   public Wood getBackWood() {
  34.     return backWood;
  35.   }
  36.  
  37.   public Wood getTopWood() {
  38.     return topWood;
  39.   }
  40.  
  41.   public int getNumStrings()
  42.   {
  43.     return numStrings;
  44.   }
  45.  
  46.   public boolean matches( GuitarSpec otherSpec  )
  47.   {
  48.     if (builder != otherSpec.getBuilder())
  49.         return false;
  50.  
  51.     if ((model != null) && (!model.equals("")) &&
  52.         (!model.equals(otherSpec.getModel().toLowerCase())))
  53.         return false;;
  54.  
  55.     if (type != otherSpec.getType())
  56.         return false;
  57.  
  58.     if (backWood != otherSpec.getBackWood())
  59.         return false;
  60.  
  61.     if (topWood != otherSpec.getTopWood())
  62.         return false;
  63.        
  64.     if ( numStrings != otherSpec.getNumStrings() )
  65.         return false;
  66.        
  67.     return false;
  68.   }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement