| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.ws.params.simple; |
| 22 |
|
|
| 23 |
|
import java.net.URL; |
| 24 |
|
import java.util.Arrays; |
| 25 |
|
import java.util.List; |
| 26 |
|
|
| 27 |
|
import jalview.ws.params.ArgumentI; |
| 28 |
|
|
| |
|
| 45.5% |
Uncovered Elements: 18 (33) |
Complexity: 19 |
Complexity Density: 1.73 |
|
| 29 |
|
public class BooleanOption extends Option |
| 30 |
|
{ |
| |
|
| 85.7% |
Uncovered Elements: 2 (14) |
Complexity: 7 |
Complexity Density: 1.4 |
|
| 31 |
|
public static class Builder extends Option.Builder |
| 32 |
|
{ |
| 33 |
|
private boolean defaultValue = false; |
| 34 |
|
|
| 35 |
|
private boolean value = false; |
| 36 |
|
|
| 37 |
|
private String reprValue = null; |
| 38 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 39 |
4711 |
public void setDefaultValue(Boolean defaultValue)... |
| 40 |
|
{ |
| 41 |
4711 |
this.defaultValue = defaultValue != null ? defaultValue : false; |
| 42 |
|
} |
| 43 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 44 |
4711 |
public void setValue(Boolean value)... |
| 45 |
|
{ |
| 46 |
4711 |
this.value = value != null ? value : false; |
| 47 |
|
} |
| 48 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 49 |
1872 |
public void setReprValue(String reprValue)... |
| 50 |
|
{ |
| 51 |
1872 |
this.reprValue = reprValue; |
| 52 |
|
} |
| 53 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 54 |
0 |
@Override... |
| 55 |
|
public void setPossibleValues(List<String> possibleValues) |
| 56 |
|
{ |
| 57 |
0 |
throw new UnsupportedOperationException("cannot set possible values for boolean"); |
| 58 |
|
} |
| 59 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 60 |
4711 |
@Override... |
| 61 |
|
public BooleanOption build() |
| 62 |
|
{ |
| 63 |
4711 |
return new BooleanOption(this); |
| 64 |
|
} |
| 65 |
|
} |
| 66 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 67 |
2943 |
public static Builder newBuilder()... |
| 68 |
|
{ |
| 69 |
2943 |
return new Builder(); |
| 70 |
|
} |
| 71 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 72 |
4711 |
protected BooleanOption(Builder builder)... |
| 73 |
|
{ |
| 74 |
4711 |
super(builder); |
| 75 |
4711 |
String reprValue = builder.reprValue != null ? builder.reprValue : name; |
| 76 |
4711 |
defvalue = builder.defaultValue ? reprValue : null; |
| 77 |
4711 |
value = builder.value ? reprValue : null; |
| 78 |
4711 |
possibleVals = List.of(reprValue); |
| 79 |
4711 |
displayVals = List.of(label); |
| 80 |
|
} |
| 81 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 5 |
Complexity Density: 5 |
|
| 82 |
0 |
public BooleanOption(String name, String descr, boolean required,... |
| 83 |
|
Boolean defVal, Boolean val, URL link) |
| 84 |
|
{ |
| 85 |
0 |
super(name, descr, required, (defVal != null && defVal ? name : null), |
| 86 |
0 |
(val != null && val ? name : null), Arrays.asList(name), link); |
| 87 |
|
} |
| 88 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 5 |
Complexity Density: 5 |
|
| 89 |
0 |
public BooleanOption(String name, String description, String label,... |
| 90 |
|
boolean isrequired, Boolean defValue, String reprValue, URL link) |
| 91 |
|
{ |
| 92 |
0 |
super(name, description, label, isrequired, |
| 93 |
0 |
defValue != null && defValue ? reprValue : null, |
| 94 |
0 |
defValue != null && defValue ? reprValue : null, |
| 95 |
|
Arrays.asList(reprValue), link); |
| 96 |
|
} |
| 97 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 98 |
0 |
public BooleanOption(String name, String description, String label,... |
| 99 |
|
boolean isrequired, Boolean defValue, URL link) |
| 100 |
|
{ |
| 101 |
0 |
this(name, description, label, isrequired, defValue, String.valueOf(true), link); |
| 102 |
|
} |
| 103 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 3 |
Complexity Density: 3 |
|
| 104 |
0 |
public static Boolean parseBoolean(ArgumentI argument)... |
| 105 |
|
{ |
| 106 |
0 |
return argument.getValue() != null && !argument.getValue().isEmpty() ? |
| 107 |
|
true : false; |
| 108 |
|
} |
| 109 |
|
} |