Advertisement
Guest User

Untitled

a guest
Feb 9th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1.     public class Var implements Comparable<Var> {
  2.  
  3.         private String string, replace;
  4.         private List<Type> types;
  5.  
  6.         public Var(String string, String replace, List<Type> types) {
  7.             this.string = string;
  8.             this.replace = replace;
  9.             this.types = types;
  10.         }
  11.  
  12.         public String getKey() {
  13.             return string;
  14.         }
  15.  
  16.         public String getReplace() {
  17.             return replace;
  18.         }
  19.  
  20.         public boolean canUse(Type type) {
  21.             return types.contains(type);
  22.         }
  23.  
  24.         @Override
  25.         public int compareTo(Var var) {
  26.             if (var == null)
  27.                 return 1;
  28.             return var.getKey().equals(this.getKey()) ? 0 : 1;
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement