List of usage examples for java.util Objects nonNull
public static boolean nonNull(Object obj)
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public Map<Integer, List<double[]>> getSpikeInterpolation() { double[] sunZenithAngles = getSunZenithAngles(); double[] viewZenithAngles = getViewZenithAngles(); Map<Integer, List<double[]>> interpolate = new HashMap<>(); if (Objects.nonNull(sunZenithAngles) && Objects.nonNull(viewZenithAngles)) { for (int index = 0; index < sunZenithAngles.length; index++) { double yVal = viewZenithAngles[index]; double xVal = sunZenithAngles[index]; double thetaMin = thetas[0]; double thetaMax = thetas[thetas.length - 1]; List<double[]> valueList = new ArrayList<>(); for (int i = 0; i < rayCooefMatrixA.length; i++) { double[] values = new double[4]; if (yVal > thetaMin && yVal < thetaMax && xVal > thetaMin && xVal < thetaMax) { values[0] = SpikeInterpolation.interpolate2D(rayCooefMatrixA[i], thetas, thetas, xVal, yVal);//from www .ja v a 2 s . c om values[1] = SpikeInterpolation.interpolate2D(rayCooefMatrixB[i], thetas, thetas, xVal, yVal); values[2] = SpikeInterpolation.interpolate2D(rayCooefMatrixC[i], thetas, thetas, xVal, yVal); values[3] = SpikeInterpolation.interpolate2D(rayCooefMatrixD[i], thetas, thetas, xVal, yVal); valueList.add(values); } else { if (yVal < thetaMin && xVal < thetaMax) { valueList.add(getGridValueAt(0, 0)); } else { int len = thetas.length - 1; if (yVal > thetaMax && xVal > thetaMin) { valueList.add(getGridValueAt(0, len)); } else if (xVal < thetaMin && yVal < thetaMax) { valueList.add(getGridValueAt(0, 0)); } else if (yVal > thetaMax && xVal < thetaMin) { valueList.add(getGridValueAt(len, len)); } } } } interpolate.put(index, valueList); } } return interpolate; }
From source file:org.openecomp.sdc.translator.services.heattotosca.impl.BaseResourceConnection.java
void createRequirementAssignment(Map.Entry<String, RequirementDefinition> entry, String node, NodeTemplate nodeTemplate) {//from w ww. j av a 2 s .c om if (Objects.nonNull(node)) { RequirementAssignment requirementAssignment; requirementAssignment = new RequirementAssignment(); requirementAssignment.setRelationship(entry.getValue().getRelationship()); requirementAssignment.setCapability(entry.getValue().getCapability()); requirementAssignment.setNode(node); DataModelUtil.addRequirementAssignment(nodeTemplate, entry.getKey(), requirementAssignment); } }
From source file:io.redlink.solrlib.embedded.EmbeddedCoreContainer.java
@Override protected SolrClient createSolrClient(String coreName) { Preconditions.checkState(Objects.nonNull(coreContainer), "CoreContainer not initialized!"); Preconditions.checkArgument(StringUtils.isNotBlank(coreName)); return new EmbeddedSolrServer(coreContainer, coreName) { @Override//from w w w.j a v a 2 s . co m public void close() throws IOException { //nop } }; }
From source file:org.kitodo.production.services.data.TaskService.java
/** * Method saves or removes dependencies with process, users and user's * groups related to modified task.//w ww. j a v a2 s. c om * * @param task * object */ @Override protected void manageDependenciesForIndex(Task task) throws CustomResponseException, DataException, IOException { if (Objects.nonNull(task.getProcess())) { manageProcessDependenciesForIndex(task); } else if (Objects.nonNull(task.getTemplate())) { manageTemplateDependenciesForIndex(task); } }
From source file:org.openecomp.sdc.validation.impl.util.ResourceValidationHeatValidator.java
private static void validateResourceGroupType(String fileName, Map.Entry<String, Resource> resourceEntry, GlobalValidationContext globalContext) { Resource resourceDef = HeatStructureUtil.getResourceDef(fileName, resourceEntry.getKey(), resourceEntry.getValue(), globalContext); // validateResourceGroupTypeIsSupported(fileName, resourceEntry.getKey(),resourceDef.getType(), // globalContext); if (resourceDef != null) { if (Objects.nonNull(resourceDef.getType()) && HeatValidationService.isNestedResource(resourceDef.getType())) { handleNestedResourceType(fileName, resourceDef.getType(), resourceDef, globalContext); }//from w ww . j a va2 s .c o m } }
From source file:org.kitodo.production.services.data.BatchService.java
/** * The function contains() returns true if the title (if set) or the * id-based label contain the specified sequence of char values. * * @param sequence//from ww w . ja v a 2s. c om * the sequence to search for * @return true if the title or label contain s, false otherwise */ public boolean contains(Batch batch, CharSequence sequence) { return Objects.isNull(sequence) || Objects.nonNull(batch.getTitle()) && batch.getTitle().contains(sequence) || getNumericLabel(batch).contains(sequence); }
From source file:org.goobi.production.cli.helper.CopyProcess.java
private void setMetadataForMetadataFile(AdditionalField field, LegacyDocStructHelperInterface myTempStruct) { if (field.getMetadata().equals("ListOfCreators")) { throw new UnsupportedOperationException("Dead code pending removal"); } else {/*from w w w . j av a2s.c o m*/ /* evaluate the content in normal fields */ LegacyMetadataTypeHelper mdt = LegacyPrefsHelper.getMetadataType( ServiceManager.getRulesetService().getPreferences(this.prozessKopie.getRuleset()), field.getMetadata()); LegacyMetadataHelper md = LegacyLogicalDocStructHelper.getMetadata(myTempStruct, mdt); if (Objects.nonNull(md)) { field.setValue(md.getValue()); } } }
From source file:org.kitodo.MockDatabase.java
private static String readMapping() { ClassLoader classloader = Thread.currentThread().getContextClassLoader(); try (InputStream inputStream = classloader.getResourceAsStream("mapping.json")) { if (Objects.nonNull(inputStream)) { String mapping = IOUtils.toString(inputStream, StandardCharsets.UTF_8); try (JsonReader jsonReader = Json.createReader(new StringReader(mapping))) { JsonObject jsonObject = jsonReader.readObject(); return jsonObject.toString(); }//from w ww . ja v a 2s . c o m } else { return ""; } } catch (IOException e) { logger.error(e.getMessage(), e); } return ""; }
From source file:org.kitodo.production.forms.dataeditor.StructurePanel.java
private static MediaUnit preservePhysicalRecursive(TreeNode treeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); if (Objects.isNull(structureTreeNode) || !(structureTreeNode.getDataObject() instanceof MediaUnit)) { return null; }/*from w w w .j ava 2 s. c om*/ MediaUnit mediaUnit = (MediaUnit) structureTreeNode.getDataObject(); List<MediaUnit> childrenLive = mediaUnit.getChildren(); childrenLive.clear(); for (TreeNode child : treeNode.getChildren()) { MediaUnit possibleChildMediaUnit = preservePhysicalRecursive(child); if (Objects.nonNull(possibleChildMediaUnit)) { childrenLive.add(possibleChildMediaUnit); } } return mediaUnit; }
From source file:org.kitodo.production.forms.dataeditor.FieldedMetadataTableRow.java
/** * Reads the labels from the structure (if any) and adds them to the * returned meta-data collection./*from w w w .j a v a 2 s . c o m*/ * * @param metadata * available meta-data * @return meta-data with labels, if any */ private Collection<Metadata> addLabels(Collection<Metadata> metadata) { Collection<Metadata> displayMetadata = metadata; if (Objects.nonNull(structure)) { displayMetadata = new ArrayList<>(metadata); if (Objects.nonNull(structure.getLabel())) { MetadataEntry label = new MetadataEntry(); label.setKey("LABEL"); label.setValue(structure.getLabel()); displayMetadata.add(label); } if (Objects.nonNull(structure.getOrderlabel())) { MetadataEntry label = new MetadataEntry(); label.setKey("ORDERLABEL"); label.setValue(structure.getLabel()); displayMetadata.add(label); } } return displayMetadata; }