import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import java.util.Optional;
import java.util.Vector;
import static java.lang.String.format;
ArrayList<SequenceFeature> feats = new ArrayList<>(
seq.getFeatures().getAllFeatures());
sqinfo.features = Optional.of(feats);
- sqinfo.pdbId = Optional.of(Objects.requireNonNullElse(
- seq.getAllPDBEntries(), new ArrayList<>()));
+ var pdbEntries = seq.getAllPDBEntries();
+ sqinfo.pdbId = Optional.of(pdbEntries != null ? pdbEntries : new ArrayList<>());
}
if (seq.hasHMMProfile())
{
import java.util.Arrays;
import java.util.List;
-import static java.util.Objects.requireNonNullElse;
-
public class BooleanOption extends Option
{
public static class Builder extends Option.Builder
public void setDefaultValue(Boolean defaultValue)
{
- this.defaultValue = requireNonNullElse(defaultValue, false);
+ this.defaultValue = defaultValue != null ? defaultValue : false;
}
public void setValue(Boolean value)
{
- this.value = requireNonNullElse(value, false);
+ this.value = value != null ? value : false;
}
public void setReprValue(String reprValue)
protected BooleanOption(Builder builder)
{
super(builder);
- String reprValue = requireNonNullElse(builder.reprValue, name);
+ String reprValue = builder.reprValue != null ? builder.reprValue : name;
defvalue = builder.defaultValue ? reprValue : null;
value = builder.value ? reprValue : null;
possibleVals = List.of(reprValue);
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
-import static java.util.Objects.requireNonNullElse;
/**
*
public void setMin(Double min)
{
- this.min = requireNonNullElse(min, Double.POSITIVE_INFINITY);
+ this.min = min != null ? min : Double.POSITIVE_INFINITY;
}
public void setMax(Double max)
{
- this.max = requireNonNullElse(max, Double.NEGATIVE_INFINITY);
+ this.max = max != null ? max : Double.NEGATIVE_INFINITY;
}
public void setBounds(Double min, Double max)
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
-import static java.util.Objects.requireNonNullElse;
/**
* @author jimp
public void setMin(Integer min)
{
- this.min = requireNonNullElse(min, Integer.MAX_VALUE);
+ this.min = min != null ? min : Integer.MAX_VALUE;
}
public void setMax(Integer max)
- {
- this.max = requireNonNullElse(max, Integer.MIN_VALUE);
+ {
+ this.max = max != null ? max : Integer.MIN_VALUE;
}
public void setBounds(Integer min, Integer max)
package jalview.ws.params.simple;
-import static java.util.Objects.requireNonNullElse;
-
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
public void setMin(Double min)
{
- this.min = requireNonNullElse(min, Double.POSITIVE_INFINITY);
+ this.min = min != null ? min : Double.POSITIVE_INFINITY;
}
public void setMax(Double max)
{
- this.max = requireNonNullElse(max, Double.NEGATIVE_INFINITY);
+ this.max = max != null ? max : Double.NEGATIVE_INFINITY;
}
public void setBounds(Double min, Double max)
import java.util.ArrayList;
import java.util.List;
import static java.util.Objects.requireNonNull;
-import static java.util.Objects.requireNonNullElse;
public class Option implements OptionI
{
{
requireNonNull(builder.name);
name = builder.name;
- label = requireNonNullElse(builder.label, name);
+ label = builder.label != null ? builder.label : name;
description = builder.description;
required = builder.required;
defvalue = builder.defaultValue;
import jalview.ws2.helpers.DelegateJobEventListener;
import jalview.ws2.helpers.TaskEventSupport;
-import static java.util.Objects.requireNonNullElse;
-
public class AnnotationTask implements TaskI<AnnotationResult>
{
private final long uid = MathUtils.getUID();
private void updateOurAnnots(List<AlignmentAnnotation> newAnnots)
{
- List<AlignmentAnnotation> oldAnnots = requireNonNullElse(ourAnnots, Collections.emptyList());
+ List<AlignmentAnnotation> oldAnnots = ourAnnots != null ? ourAnnots : Collections.emptyList();
ourAnnots = newAnnots;
AlignmentI alignment = viewport.getAlignment();
for (AlignmentAnnotation an : oldAnnots)
package jalview.ws2.client.slivka;
-import static java.util.Objects.requireNonNullElse;
-
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
class SlivkaParamStoreFactory
{
private final SlivkaService service;
+
private final ParamManager manager;
SlivkaParamStoreFactory(SlivkaService service, ParamManager manager)
this.service = service;
this.manager = manager;
}
-
+
ParamDatastoreI createParamDatastore()
{
URL url = null;
List<ArgumentI> arguments = createPresetArguments(Collections.emptyMap());
return new SimpleParamDatastore(url, arguments, presets, manager);
}
-
+
WsParamSetI createPreset(SlivkaService.Preset preset)
{
var builder = SimpleParamSet.newBuilder();
private List<Option> createChoiceOptions(Parameter.ChoiceParameter param, List<String> value)
{
- value = requireNonNullElse(value, Collections.emptyList());
+ value = value != null ? value : Collections.emptyList();
if (param.isArray())
{
/*
* Use multiple boolean checkboxes to represent the value.
*/
List<Option> options = new ArrayList<>();
- List<?> selected = requireNonNullElse(
- (List<?>) param.getDefault(), Collections.emptyList());
+ List<?> selected = param.getDefault() != null
+ ? (List<?>) param.getDefault()
+ : Collections.emptyList();
int i = 0;
var builder = BooleanOption.newBuilder();
setCommonProperties(param, builder);
package jalview.ws2.gui;
-import static java.util.Objects.requireNonNullElse;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
String panelInfo = String.format("%s using service hosted at %s%n%s",
service.getName(), service.getUrl(), service.getDescription());
infoPanel = new WebserviceInfo(service.getName(), panelInfo, false);
- String actionName = requireNonNullElse(action.getName(), "Alignment");
+ String actionName = action.getName() != null ? action.getName() : "Alignment";
alnTitle = String.format("%s %s of %s", service.getName(), actionName,
frame.getTitle());
}
import jalview.ws2.client.api.WebServiceProviderI;
import static java.lang.String.format;
-import static java.util.Objects.requireNonNullElse;
public class WebServicesMenuManager
{
{
actionsByCategory
.computeIfAbsent(
- Objects.requireNonNullElse(action.getSubcategory(), ""),
+ action.getSubcategory() != null ? action.getSubcategory() : "",
k -> new ArrayList<>())
.add(action);
}
{
actionsByCategory
.computeIfAbsent(
- requireNonNullElse(action.getSubcategory(), ""),
+ action.getSubcategory() != null ? action.getSubcategory() : "",
k -> new ArrayList<>())
.add(action);
}