| 1 33 package net.sf.jga.fn.adaptor; 34 35 import net.sf.jga.fn.BinaryFunctor; 36 37 46 47 public class ConstantBinary<T1,T2,V> extends BinaryFunctor<T1,T2,V> { 48 49 static final long serialVersionUID = 2834438191454731796L; 50 51 private V _value; 53 54 58 public ConstantBinary (V val) { 59 _value = val; 60 } 61 62 64 71 72 public V fn(T1 unused, T2 ignored) { 73 return _value; 74 } 75 76 80 public void accept(net.sf.jga.fn.Visitor v) { 81 if (v instanceof ConstantBinary.Visitor) 82 ((ConstantBinary.Visitor)v).visit(this); 83 else 84 v.visit(this); 85 } 86 87 89 public String toString() { 90 return "const " +_value; 91 } 92 93 95 98 public interface Visitor extends net.sf.jga.fn.Visitor { 99 public void visit(ConstantBinary host); 100 } 101 } 102 103 | Popular Tags |