1 package spoon.examples.bound.template; 2 3 import spoon.template.Parameter; 4 import spoon.template.Template; 5 6 public class BoundTemplate implements Template { 7 8 @Parameter 9 String _parameter_; 10 11 @Parameter 12 double _minBound_; 13 14 @Parameter 15 double _maxBound_; 16 17 public BoundTemplate(String parameterName,double minBound,double maxBound) { 18 _parameter_=parameterName; 19 _maxBound_=maxBound; 20 _minBound_=minBound; 21 } 22 23 public void test(Double _parameter_) throws Throwable { 24 if(_parameter_ > _maxBound_) { 25 throw new RuntimeException ("out of max bound ("+_parameter_+">"+_maxBound_); 26 } 27 if(_parameter_ < _minBound_) { 28 throw new RuntimeException ("out of min bound ("+_parameter_+"<"+_minBound_); 29 } 30 } 31 32 } 33 | Popular Tags |