use of ucar.nc2.Group in project google-cloud-java by GoogleCloudPlatform.
the class GroupServiceClientTest method getGroupTest.
@Test
@SuppressWarnings("all")
public void getGroupTest() {
GroupName name2 = GroupName.create("[PROJECT]", "[GROUP]");
String displayName = "displayName1615086568";
GroupName parentName = GroupName.create("[PROJECT]", "[GROUP]");
String filter = "filter-1274492040";
boolean isCluster = false;
Group expectedResponse = Group.newBuilder().setNameWithGroupName(name2).setDisplayName(displayName).setParentNameWithGroupName(parentName).setFilter(filter).setIsCluster(isCluster).build();
mockGroupService.addResponse(expectedResponse);
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
Group actualResponse = client.getGroup(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetGroupRequest actualRequest = (GetGroupRequest) actualRequests.get(0);
Assert.assertEquals(name, actualRequest.getNameAsGroupName());
}
use of ucar.nc2.Group in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method createSubProcessDiagram.
private void createSubProcessDiagram(BPMNPlane plane, FlowElement flowElement, BpmnDiFactory factory) {
SubProcess sp = (SubProcess) flowElement;
for (FlowElement subProcessFlowElement : sp.getFlowElements()) {
if (subProcessFlowElement instanceof SubProcess) {
createBpmnShapeForElement(factory, plane, subProcessFlowElement);
createSubProcessDiagram(plane, subProcessFlowElement, factory);
} else if (subProcessFlowElement instanceof FlowNode) {
createBpmnShapeForElement(factory, plane, subProcessFlowElement);
if (subProcessFlowElement instanceof BoundaryEvent) {
createDockersForBoundaryEvent((BoundaryEvent) subProcessFlowElement);
}
} else if (subProcessFlowElement instanceof SequenceFlow) {
createBpmnEdgeForSequenceFlow(factory, plane, (SequenceFlow) subProcessFlowElement);
}
}
if (sp.getArtifacts() != null) {
List<Association> incompleteAssociations = new ArrayList<Association>();
for (Artifact artifact : sp.getArtifacts()) {
// if (artifact instanceof TextAnnotation || artifact instanceof Group) {
if (artifact instanceof Group) {
createBpmnShapeForElement(factory, plane, artifact);
}
if (artifact instanceof Association) {
Association association = (Association) artifact;
if (association.getSourceRef() != null && association.getTargetRef() != null) {
createBpmnEdgeForAssociation(factory, plane, association);
} else {
incompleteAssociations.add(association);
}
}
}
if (!incompleteAssociations.isEmpty()) {
for (Association incompleteAssociation : incompleteAssociations) {
sp.getArtifacts().remove(incompleteAssociation);
}
}
}
}
use of ucar.nc2.Group in project bioformats by openmicroscopy.
the class NetCDFServiceImpl method getDimension.
@Override
public int getDimension(String name) {
String groupName = getDirectory(name);
String variableName = getName(name);
Group group = getGroup(groupName);
return group.findDimension(variableName).getLength();
}
use of ucar.nc2.Group in project bioformats by openmicroscopy.
the class NetCDFServiceImpl method getArray.
/* (non-Javadoc)
* @see loci.formats.NetCDFService#getArray(java.lang.String, int[], int[])
*/
@Override
public Object getArray(String path, int[] origin, int[] shape) throws ServiceException {
String groupName = getDirectory(path);
String variableName = getName(path);
Group group = getGroup(groupName);
Variable variable = group.findVariable(variableName);
try {
if (origin != null && shape != null) {
return variable.read(origin, shape).reduce().copyToNDJavaArray();
}
return variable.read().copyToNDJavaArray();
} catch (InvalidRangeException e) {
throw new ServiceException(e);
} catch (IOException e) {
throw new ServiceException(e);
} catch (NullPointerException e) {
return null;
}
}
use of ucar.nc2.Group in project sis by apache.
the class DecoderWrapper method numericValue.
/**
* Returns the value of the attribute of the given name as a number, or {@code null} if none.
*
* @param name the name of the attribute to search, or {@code null}.
* @return the attribute value, or {@code null} if none or unparsable or if the given name was null.
*/
@Override
public Number numericValue(final String name) {
if (name != null) {
for (final Group group : groups) {
final Attribute attribute = findAttribute(group, name);
if (attribute != null) {
final Number value = attribute.getNumericValue();
if (value != null) {
return value;
}
String asString = attribute.getStringValue();
if (asString != null && !(asString = asString.trim()).isEmpty()) {
return parseNumber(asString);
}
}
}
}
return null;
}
Aggregations