Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.18 KB | None | 0 0
  1. // before
  2. public enum Compatibility
  3.     {
  4.         Compatible, Information_missing, Not_compatible;
  5.  
  6.         public Compatibility and(Compatibility other)
  7.         {
  8.             if(other.equals(this)) return this;
  9.             if(other.equals(Compatible) && this.equals(Information_missing)) return Information_missing;
  10.             if(other.equals(Information_missing) && this.equals(Compatible)) return Information_missing;
  11.             if(other.equals(Compatible) && this.equals(Not_compatible)) return Not_compatible;
  12.             if(other.equals(Not_compatible) && this.equals(Compatible)) return Not_compatible;
  13.             if(other.equals(Information_missing) && this.equals(Not_compatible)) return Not_compatible;
  14.             if(other.equals(Not_compatible) && this.equals(Information_missing)) return Not_compatible;
  15.             return null;
  16.         }
  17.  
  18.         public Compatibility or(Compatibility other)
  19.         {
  20.             if(other.equals(this)) return this;
  21.             if(other.equals(Compatible) && this.equals(Information_missing)) return Compatible;
  22.             if(other.equals(Information_missing) && this.equals(Compatible)) return Compatible;
  23.             if(other.equals(Compatible) && this.equals(Not_compatible)) return Compatible;
  24.             if(other.equals(Not_compatible) && this.equals(Compatible)) return Compatible;
  25.             if(other.equals(Information_missing) && this.equals(Not_compatible)) return Information_missing;
  26.             if(other.equals(Not_compatible) && this.equals(Information_missing)) return Information_missing;
  27.             return null;
  28.         }
  29.     }
  30.  
  31.  
  32. // after
  33. public enum Compatibility
  34.     {
  35.                 public Compatibility and(Compatibility other)
  36.         {
  37.             if(other.equals(this)) return this;
  38.             if(other.equals(Compatible) && this.equals(Information_missing)) return Information_missing;
  39.             if(other.equals(Information_missing) && this.equals(Compatible)) return Information_missing;
  40.             if(other.equals(Compatible) && this.equals(Not_compatible)) return Not_compatible;
  41.             if(other.equals(Not_compatible) && this.equals(Compatible)) return Not_compatible;
  42.             if(other.equals(Information_missing) && this.equals(Not_compatible)) return Not_compatible;
  43.             if(other.equals(Not_compatible) && this.equals(Information_missing)) return Not_compatible;
  44.             return null;
  45.         }, Information_missing, Not_compatible;
  46.  
  47.         public Compatibility or(Compatibility other)
  48.         {
  49.             if(other.equals(this)) return this;
  50.             if(other.equals(Compatible) && this.equals(Information_missing)) return Compatible;
  51.             if(other.equals(Information_missing) && this.equals(Compatible)) return Compatible;
  52.             if(other.equals(Compatible) && this.equals(Not_compatible)) return Compatible;
  53.             if(other.equals(Not_compatible) && this.equals(Compatible)) return Compatible;
  54.             if(other.equals(Information_missing) && this.equals(Not_compatible)) return Information_missing;
  55.             if(other.equals(Not_compatible) && this.equals(Information_missing)) return Information_missing;
  56.             return null;
  57.         }
  58. Compatible
  59.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement