JAL-2629 add StringParameter
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Mon, 28 Aug 2017 11:13:13 +0000 (12:13 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Mon, 28 Aug 2017 11:13:13 +0000 (12:13 +0100)
src/jalview/ws/params/simple/StringParameter.java [new file with mode: 0644]

diff --git a/src/jalview/ws/params/simple/StringParameter.java b/src/jalview/ws/params/simple/StringParameter.java
new file mode 100644 (file)
index 0000000..1d6a37e
--- /dev/null
@@ -0,0 +1,118 @@
+package jalview.ws.params.simple;
+
+import jalview.ws.params.ParameterI;
+import jalview.ws.params.ValueConstrainI;
+
+import java.net.URL;
+import java.util.List;
+
+public class StringParameter extends Option implements ParameterI
+{
+
+  @Override
+  public URL getFurtherDetails()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public boolean isRequired()
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  @Override
+  public String getDescription()
+  {
+    // TODO Auto-generated method stub
+    return description;
+  }
+
+  @Override
+  public List<String> getPossibleValues()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public String getName()
+  {
+    // TODO Auto-generated method stub
+    return name;
+  }
+
+  @Override
+  public String getValue()
+  {
+    // TODO Auto-generated method stub
+    return value;
+  }
+
+  @Override
+  public void setValue(String selectedItem)
+  {
+    value = selectedItem;
+
+  }
+
+  @Override
+  public ValueConstrainI getValidValue()
+  {
+    // TODO Auto-generated method stub
+    return new StringValueConstrain();
+  }
+
+  @Override
+  public ParameterI copy()
+  {
+    return new StringParameter(this);
+  }
+
+  private class StringValueConstrain implements ValueConstrainI
+  {
+
+    @Override
+    public ValueType getType()
+    {
+      return ValueType.String;
+    }
+
+    @Override
+    public Number getMax()
+    {
+      return null;
+    }
+
+    @Override
+    public Number getMin()
+    {
+      return null;
+    }
+
+  }
+
+  public StringParameter(StringParameter parm)
+  {
+    this.name = parm.name;
+    this.defvalue = parm.defvalue;
+  }
+
+  public StringParameter(String name, String description, boolean required,
+          String defValue)
+  {
+    super(name, description, required, String.valueOf(defValue), null, null,
+            null);
+    this.defvalue = defValue;
+  }
+
+  public StringParameter(String name, String description, boolean required,
+          String defValue, String value)
+  {
+    super(name, description, required, String.valueOf(defValue),
+            String.valueOf(value), null, null);
+    this.defvalue = defValue;
+  }
+}