Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. package corseworkerino;
  2.  
  3. public class Entry {
  4.  
  5.   private float number;
  6.   private String string;
  7.   private Type type;
  8.   private Symbol symbol;
  9.  
  10.   public Entry(float inputNumber) {
  11.     type = Type.NUMBER;
  12.     number = inputNumber;
  13.   }
  14.  
  15.   public Entry(String inputString) {
  16.     type = Type.STRING;
  17.     this.string = inputString;
  18.   }
  19.  
  20.   public Entry(Symbol inputSymbol) {
  21.     type = Type.SYMBOL;
  22.     this.symbol = inputSymbol;
  23.   }
  24.  
  25.   public float getValue() {
  26.     return number;
  27.   }
  28.  
  29.   public void setValue(int i) {
  30.     number = i;
  31.   }
  32.  
  33.   public String getString() {
  34.     return string;
  35.   }
  36.  
  37.   public Type getType() {
  38.     return type;
  39.   }
  40.  
  41.   public Symbol getSymbol() {
  42.     return symbol;
  43.   }
  44.  
  45.   @Override
  46.   public final boolean equals(Object object)
  47.  {
  48.     if(this == object) {
  49.       return true;
  50.     }
  51.     if(object == null) {
  52.       return false;
  53.     }
  54.     if(getClass() != object.getClass()) {
  55.       return false;
  56.     }
  57.     Entry other = (Entry)object;
  58.     if (symbol != object) {
  59.       return false;
  60.     }
  61.     return true;  
  62.   }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement