1
2
3
4 package net.sf.bddbddb.order;
5
6 /***
7 * Translate from one order to another. Used when orders have different names.
8 *
9 * @author jwhaley
10 * @version $Id: OrderTranslator.java 364 2004-10-31 14:13:49Z joewhaley $
11 */
12 public interface OrderTranslator {
13
14 /***
15 * Translate the given order. Always generates a new Order object, even if
16 * the order does not change.
17 *
18 * @param o order
19 * @return translated order
20 */
21 Order translate(Order o);
22
23 public static class Compose implements OrderTranslator {
24
25 OrderTranslator t1, t2;
26
27 public Compose(OrderTranslator t1, OrderTranslator t2) {
28 this.t1 = t1; this.t2 = t2;
29 }
30
31
32
33
34 public Order translate(Order o) {
35 return t2.translate(t1.translate(o));
36 }
37
38 }
39
40 }