1 33 package net.sf.jga.fn.adaptor; 34 35 import net.sf.jga.fn.Generator; 36 37 44 45 public class Constant<V> extends Generator<V> { 46 47 static final long serialVersionUID = 8451989044496281343L; 48 49 private V _value; 50 51 55 public Constant (V val) { 56 _value = val; 57 } 58 59 60 62 66 67 public V gen() { 68 return _value; 69 } 70 71 75 public void accept(net.sf.jga.fn.Visitor v) { 76 if (v instanceof Constant.Visitor) 77 ((Constant.Visitor)v).visit(this); 78 else 79 v.visit(this); 80 } 81 82 84 public String toString() { 85 return "const " +_value; 86 } 87 88 90 93 public interface Visitor extends net.sf.jga.fn.Visitor { 94 public void visit(Constant host); 95 } 96 } 97 98 | Popular Tags |