Mercurial > hg > Members > tatsuki > bench > jungle-core
comparison src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/util/DefaultEither.java @ 22:9fd57b7c6adb
added Either
author | Shoshi TAMAKI |
---|---|
date | Mon, 07 Jan 2013 23:22:36 +0900 |
parents | |
children | 3ef2a66a8c5d |
comparison
equal
deleted
inserted
replaced
21:848f73545c4d | 22:9fd57b7c6adb |
---|---|
1 package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util; | |
2 | |
3 public class DefaultEither<A,B> implements Either<A,B> | |
4 { | |
5 private final A theA; | |
6 private final B theB; | |
7 | |
8 public DefaultEither(A _theA) | |
9 { | |
10 theA = _theA; | |
11 theB = null; | |
12 } | |
13 | |
14 @Override | |
15 public A a() | |
16 { | |
17 return theA; | |
18 } | |
19 | |
20 @Override | |
21 public boolean isA() | |
22 { | |
23 return (theA == null) ? true : false; | |
24 } | |
25 | |
26 @Override | |
27 public B b() | |
28 { | |
29 return theB; | |
30 } | |
31 | |
32 @Override | |
33 public boolean isB() | |
34 { | |
35 return (theB == null) ? true : false; | |
36 } | |
37 } |