| 1 |
|
package jalview.ws.params.simple; |
| 2 |
|
|
| 3 |
|
import jalview.ws.params.ParameterI; |
| 4 |
|
import jalview.ws.params.ValueConstrainI; |
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
@author |
| 11 |
|
|
| |
|
| 0% |
Uncovered Elements: 40 (40) |
Complexity: 13 |
Complexity Density: 0.54 |
|
| 12 |
|
public class LogarithmicParameter extends Option implements ParameterI |
| 13 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 12 |
Complexity Density: 0.92 |
|
| 14 |
|
public static class Builder extends Option.Builder |
| 15 |
|
{ |
| 16 |
|
|
| 17 |
|
protected double min = Double.POSITIVE_INFINITY; |
| 18 |
|
|
| 19 |
|
protected double max = Double.NEGATIVE_INFINITY; |
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
@link |
| 24 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 25 |
0 |
@Override... |
| 26 |
|
public void setValue(String value) |
| 27 |
|
{ |
| 28 |
0 |
throw new UnsupportedOperationException(); |
| 29 |
|
} |
| 30 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 31 |
0 |
public void setValue(Double value)... |
| 32 |
|
{ |
| 33 |
0 |
if (value != null) |
| 34 |
0 |
super.setValue(value.toString()); |
| 35 |
|
else |
| 36 |
0 |
super.setValue(null); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
@link |
| 42 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 43 |
0 |
@Override... |
| 44 |
|
public void setDefaultValue(String defaultValue) |
| 45 |
|
{ |
| 46 |
0 |
throw new UnsupportedOperationException(); |
| 47 |
|
} |
| 48 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 49 |
0 |
public void setDefaultValue(Double defaultValue)... |
| 50 |
|
{ |
| 51 |
0 |
if (defaultValue != null) |
| 52 |
0 |
super.setDefaultValue(defaultValue.toString()); |
| 53 |
|
else |
| 54 |
0 |
super.setDefaultValue(null); |
| 55 |
|
} |
| 56 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 57 |
0 |
public void setMin(Double min)... |
| 58 |
|
{ |
| 59 |
0 |
this.min = min != null ? min : Double.POSITIVE_INFINITY; |
| 60 |
|
} |
| 61 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 62 |
0 |
public void setMax(Double max)... |
| 63 |
|
{ |
| 64 |
0 |
this.max = max != null ? max : Double.NEGATIVE_INFINITY; |
| 65 |
|
} |
| 66 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 67 |
0 |
public void setBounds(Double min, Double max)... |
| 68 |
|
{ |
| 69 |
0 |
setMin(min); |
| 70 |
0 |
setMax(max); |
| 71 |
|
} |
| 72 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
0 |
@Override... |
| 74 |
|
public LogarithmicParameter build() |
| 75 |
|
{ |
| 76 |
0 |
return new LogarithmicParameter(this); |
| 77 |
|
} |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
final double defval; |
| 81 |
|
|
| 82 |
|
final double min; |
| 83 |
|
|
| 84 |
|
final double max; |
| 85 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 86 |
0 |
@Override... |
| 87 |
|
public ValueConstrainI getValidValue() |
| 88 |
|
{ |
| 89 |
0 |
return new ValueConstrainI() |
| 90 |
|
{ |
| 91 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 92 |
0 |
@Override... |
| 93 |
|
public ValueType getType() |
| 94 |
|
{ |
| 95 |
0 |
return ValueType.Double; |
| 96 |
|
} |
| 97 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 98 |
0 |
@Override... |
| 99 |
|
public Number getMin() |
| 100 |
|
{ |
| 101 |
0 |
return min < max ? min : null; |
| 102 |
|
} |
| 103 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 104 |
0 |
@Override... |
| 105 |
|
public Number getMax() |
| 106 |
|
{ |
| 107 |
0 |
return min < max ? max : null; |
| 108 |
|
} |
| 109 |
|
}; |
| 110 |
|
} |
| 111 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 112 |
0 |
public static Builder newBuilder()... |
| 113 |
|
{ |
| 114 |
0 |
return new Builder(); |
| 115 |
|
} |
| 116 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 117 |
0 |
public LogarithmicParameter(Builder builder)... |
| 118 |
|
{ |
| 119 |
0 |
super(builder); |
| 120 |
0 |
this.min = builder.min; |
| 121 |
0 |
this.max = builder.max; |
| 122 |
0 |
if (defvalue != null) |
| 123 |
0 |
defval = Double.parseDouble(defvalue); |
| 124 |
|
else |
| 125 |
0 |
defval = 0.0; |
| 126 |
|
} |
| 127 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 128 |
0 |
public LogarithmicParameter(LogarithmicParameter parm)... |
| 129 |
|
{ |
| 130 |
0 |
super(parm); |
| 131 |
0 |
max = parm.max; |
| 132 |
0 |
min = parm.min; |
| 133 |
0 |
defval = 0D; |
| 134 |
|
} |
| 135 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 136 |
0 |
public LogarithmicParameter(String name, String description,... |
| 137 |
|
boolean required, Double defValue, double min, double max) |
| 138 |
|
{ |
| 139 |
0 |
super(name, description, required, String.valueOf(defValue), null, null, |
| 140 |
|
null); |
| 141 |
0 |
defval = defValue; |
| 142 |
0 |
this.min = min; |
| 143 |
0 |
this.max = max; |
| 144 |
|
} |
| 145 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 146 |
0 |
public LogarithmicParameter(String name, String description,... |
| 147 |
|
boolean required, Double defValue, double value, double min, |
| 148 |
|
double max) |
| 149 |
|
{ |
| 150 |
0 |
super(name, description, required, String.valueOf(defValue), |
| 151 |
|
String.valueOf(value), null, null); |
| 152 |
0 |
defval = defValue; |
| 153 |
0 |
this.min = min; |
| 154 |
0 |
this.max = max; |
| 155 |
|
} |
| 156 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 157 |
0 |
@Override... |
| 158 |
|
public LogarithmicParameter copy() |
| 159 |
|
{ |
| 160 |
0 |
return new LogarithmicParameter(this); |
| 161 |
|
} |
| 162 |
|
} |