Skip to content

Commit

Permalink
Fix whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrueden committed Jun 7, 2023
1 parent fb4d1ea commit 73a3972
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
package org.itk.wasm;

public class BinaryStream {
public byte[] data;
public byte[] data;

public BinaryStream(byte[] data) {
this.data = data;
}
public BinaryStream(byte[] data) {
this.data = data;
}
}
30 changes: 15 additions & 15 deletions packages/core/java/src/main/java/org/itk/wasm/InterfaceTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@
*/
package org.itk.wasm;
public enum InterfaceTypes {
TextFile("InterfaceTextFile"),
BinaryFile("InterfaceBinaryFile"),
TextStream("InterfaceTextStream"),
BinaryStream("InterfaceBinaryStream"),
Image("InterfaceImage"),
Mesh("InterfaceMesh"),
PolyData("InterfacePolyData"),
JsonObject("InterfaceJsonObject");
TextFile("InterfaceTextFile"),
BinaryFile("InterfaceBinaryFile"),
TextStream("InterfaceTextStream"),
BinaryStream("InterfaceBinaryStream"),
Image("InterfaceImage"),
Mesh("InterfaceMesh"),
PolyData("InterfacePolyData"),
JsonObject("InterfaceJsonObject");

private String value;
private String value;

private InterfaceTypes(String value) {
this.value = value;
}
private InterfaceTypes(String value) {
this.value = value;
}

public String getValue() {
return value;
}
public String getValue() {
return value;
}
}
64 changes: 32 additions & 32 deletions packages/core/java/src/main/java/org/itk/wasm/Pipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,34 +88,34 @@ public Pipeline(byte[] wasmBytes) {
}

public List<PipelineOutput<?>> run(List<String> args, List<PipelineOutput<?>> outputs, List<PipelineInput<?>> inputs) {
try (RunInstance ri = new RunInstance(args, outputs, inputs)) {
int returnCode = ri.delayedStart();

List<PipelineOutput<?>> populatedOutputs = new ArrayList<>();
if (!outputs.isEmpty() && returnCode == 0) {
for (int index = 0; index < outputs.size(); index++) {
PipelineOutput<?> output = outputs.get(index);
if (output.type == InterfaceTypes.TextStream) {
int dataPtr = ri.outputArrayAddress(0, index, 0);
int dataLen = ri.outputArraySize(0, index, 0);
byte[] dataBytes = ri.wasmTimeLift(dataPtr, dataLen);
String dataString = str(dataBytes);
TextStream textStream = new TextStream(dataString);
populatedOutputs.add(new PipelineOutput<>(InterfaceTypes.TextStream, textStream));
} else if (output.type == InterfaceTypes.BinaryStream) {
int dataPtr = ri.outputArrayAddress(0, index, 0);
int dataLen = ri.outputArraySize(0, index, 0);
byte[] dataBytes = ri.wasmTimeLift(dataPtr, dataLen);
BinaryStream binaryStream = new BinaryStream(dataBytes);
populatedOutputs.add(new PipelineOutput<>(InterfaceTypes.BinaryStream, binaryStream));
} else {
throw new IllegalArgumentException("Unexpected/not yet supported output.type " + output.type);
}
}
}

return populatedOutputs;
}
try (RunInstance ri = new RunInstance(args, outputs, inputs)) {
int returnCode = ri.delayedStart();

List<PipelineOutput<?>> populatedOutputs = new ArrayList<>();
if (!outputs.isEmpty() && returnCode == 0) {
for (int index = 0; index < outputs.size(); index++) {
PipelineOutput<?> output = outputs.get(index);
if (output.type == InterfaceTypes.TextStream) {
int dataPtr = ri.outputArrayAddress(0, index, 0);
int dataLen = ri.outputArraySize(0, index, 0);
byte[] dataBytes = ri.wasmTimeLift(dataPtr, dataLen);
String dataString = str(dataBytes);
TextStream textStream = new TextStream(dataString);
populatedOutputs.add(new PipelineOutput<>(InterfaceTypes.TextStream, textStream));
} else if (output.type == InterfaceTypes.BinaryStream) {
int dataPtr = ri.outputArrayAddress(0, index, 0);
int dataLen = ri.outputArraySize(0, index, 0);
byte[] dataBytes = ri.wasmTimeLift(dataPtr, dataLen);
BinaryStream binaryStream = new BinaryStream(dataBytes);
populatedOutputs.add(new PipelineOutput<>(InterfaceTypes.BinaryStream, binaryStream));
} else {
throw new IllegalArgumentException("Unexpected/not yet supported output.type " + output.type);
}
}
}

return populatedOutputs;
}
}

private static String purePosixPath(Path p) {
Expand Down Expand Up @@ -252,10 +252,10 @@ public RunInstance(List<String> args, List<PipelineOutput<?>> outputs,
public void freeAll() { freeAll.accept(); }

public ByteBuffer memoryBuffer(int offset, int length) {
ByteBuffer buffer = memory.buffer(store);
buffer.position(offset);
buffer.limit(length);
return buffer.slice();
ByteBuffer buffer = memory.buffer(store);
buffer.position(offset);
buffer.limit(length);
return buffer.slice();
}
public int memorySize() { return memory.size(store); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.itk.wasm;

public class PipelineInput<T> {
public InterfaceTypes type;
public T data;
public String path;
public InterfaceTypes type;
public T data;
public String path;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
package org.itk.wasm;

public class PipelineOutput<T> {
public InterfaceTypes type;
public T data;
public String path;
public InterfaceTypes type;
public T data;
public String path;

public PipelineOutput(InterfaceTypes type, T data) {
this.type = type;
this.data = data;
}
public PipelineOutput(InterfaceTypes type, T data) {
this.type = type;
this.data = data;
}
}
8 changes: 4 additions & 4 deletions packages/core/java/src/main/java/org/itk/wasm/TextStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
package org.itk.wasm;

public class TextStream {
public String data;
public String data;

public TextStream(String data) {
this.data = data;
}
public TextStream(String data) {
this.data = data;
}
}

0 comments on commit 73a3972

Please sign in to comment.