1 33 package net.sf.jga.fn.adaptor; 34 35 import net.sf.jga.fn.UnaryFunctor; 36 37 46 47 public class ConstantUnary<T,V> extends UnaryFunctor<T,V> { 48 49 static final long serialVersionUID = 236974866552446215L; 50 51 private V _value; 53 54 58 public ConstantUnary (V val) { 59 _value = val; 60 } 61 62 64 71 72 public V fn(T unused) { 73 return _value; 74 } 75 76 80 public void accept(net.sf.jga.fn.Visitor v) { 81 if (v instanceof ConstantUnary.Visitor) 82 ((ConstantUnary.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(ConstantUnary host); 100 } 101 } 102 103 | Popular Tags |