1 package org.incava.jagol; 2 3 import java.io.*; 4 import java.util.*; 5 6 7 10 public class DoubleOption extends NonBooleanOption 11 { 12 private Double value; 13 14 public DoubleOption(String longName, String description) 15 { 16 this(longName, description, null); 17 } 18 19 public DoubleOption(String longName, String description, Double value) 20 { 21 super(longName, description); 22 this.value = value; 23 } 24 25 28 public Double getValue() 29 { 30 return value; 31 } 32 33 36 public void setValue(Double value) 37 { 38 this.value = value; 39 } 40 41 44 public void setValue(String value) throws InvalidTypeException 45 { 46 tr.Ace.log("value: '" + value + "'"); 47 try { 48 setValue(new Double (value)); 49 } 50 catch (NumberFormatException nfe) { 51 throw new InvalidTypeException(longName + " expects double argument, not '" + value + "'"); 52 } 53 } 54 55 public String toString() 56 { 57 return value == null ? "" : value.toString(); 58 } 59 60 protected String getType() 61 { 62 return "double"; 63 } 64 65 } 66 | Popular Tags |