1 6 package tests.jfun.parsec.rfc822; 7 8 13 public final class Either { 14 private final Object obj; 15 private final boolean is_right; 16 17 21 private Either(final boolean r, final Object v) { 22 this.is_right = r; 23 this.obj = v; 24 } 25 public static Either left(Object l){ 26 return new Either(false, l); 27 } 28 public static Either right(Object r){ 29 return new Either(true, r); 30 } 31 public boolean isRight(){ 32 return is_right; 33 } 34 public Object get(){ 35 return obj; 36 } 37 public String toString(){ 38 return obj.toString(); 39 } 40 } 41 | Popular Tags |