Skip to content

Commit

Permalink
Add and run spotless formatter for Java and Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzawa-san authored and snnn committed Feb 20, 2020
1 parent ef2bba3 commit dde4df1
Show file tree
Hide file tree
Showing 23 changed files with 12,566 additions and 10,343 deletions.
8 changes: 4 additions & 4 deletions java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ wrapper {
}

spotless {
//java {
// removeUnusedImports()
// googleJavaFormat()
//}
java {
removeUnusedImports()
googleJavaFormat()
}
format 'gradle', {
target '**/*.gradle'
trimTrailingWhitespace()
Expand Down
78 changes: 36 additions & 42 deletions java/src/main/java/ai/onnxruntime/MapInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,47 @@
*/
package ai.onnxruntime;

/**
* Describes an {@link OnnxMap} object or output node.
*/
/** Describes an {@link OnnxMap} object or output node. */
public class MapInfo implements ValueInfo {

/**
* The number of entries in this map.
*/
public final int size;
/** The number of entries in this map. */
public final int size;

/**
* The Java type of the keys.
*/
public final OnnxJavaType keyType;
/** The Java type of the keys. */
public final OnnxJavaType keyType;

/**
* The Java type of the values.
*/
public final OnnxJavaType valueType;
/** The Java type of the values. */
public final OnnxJavaType valueType;

/**
* Construct a MapInfo with the specified key type and value type.
* The size is unknown and set to -1.
* @param keyType The Java type of the keys.
* @param valueType The Java type of the values.
*/
MapInfo(OnnxJavaType keyType, OnnxJavaType valueType) {
this.size = -1;
this.keyType = keyType;
this.valueType = valueType;
}
/**
* Construct a MapInfo with the specified key type and value type. The size is unknown and set to
* -1.
*
* @param keyType The Java type of the keys.
* @param valueType The Java type of the values.
*/
MapInfo(OnnxJavaType keyType, OnnxJavaType valueType) {
this.size = -1;
this.keyType = keyType;
this.valueType = valueType;
}

/**
* Construct a MapInfo with the specified size, key type and value type.
* @param size The size.
* @param keyType The Java type of the keys.
* @param valueType The Java type of the values.
*/
MapInfo(int size, OnnxJavaType keyType, OnnxJavaType valueType) {
this.size = size;
this.keyType = keyType;
this.valueType = valueType;
}
/**
* Construct a MapInfo with the specified size, key type and value type.
*
* @param size The size.
* @param keyType The Java type of the keys.
* @param valueType The Java type of the values.
*/
MapInfo(int size, OnnxJavaType keyType, OnnxJavaType valueType) {
this.size = size;
this.keyType = keyType;
this.valueType = valueType;
}

@Override
public String toString() {
String initial = size == -1 ? "MapInfo(size=UNKNOWN" : "MapInfo(size="+size;
return initial + ",keyType=" + keyType.toString() + ",valueType=" + valueType.toString() + ")";
}
@Override
public String toString() {
String initial = size == -1 ? "MapInfo(size=UNKNOWN" : "MapInfo(size=" + size;
return initial + ",keyType=" + keyType.toString() + ",valueType=" + valueType.toString() + ")";
}
}
87 changes: 44 additions & 43 deletions java/src/main/java/ai/onnxruntime/NodeInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,50 @@
*/
package ai.onnxruntime;

/**
* The info for an input or output node from an ONNX model.
*/
/** The info for an input or output node from an ONNX model. */
public class NodeInfo {

private final ValueInfo info;

private final String name;

/**
* Creates a node info object from the supplied name and value info.
*
* Called from native code.
* @param name The name of the node.
* @param info The ValueInfo for this node.
*/
public NodeInfo(String name, ValueInfo info) {
this.name = name;
this.info = info;
}

/**
* The name of the node.
* @return The name.
*/
public String getName() {
return name;
}

/**
* The type and shape information of this node.
* <p>
* WARNING: {@link MapInfo} and {@link SequenceInfo} instances returned by this type will have insufficient information in
* them as it's not available from the model without an example output.
* @return The information of the value.
*/
public ValueInfo getInfo() {
return info;
}

@Override
public String toString() {
return "NodeInfo(name="+name+",info="+info.toString()+")";
}

private final ValueInfo info;

private final String name;

/**
* Creates a node info object from the supplied name and value info.
*
* <p>Called from native code.
*
* @param name The name of the node.
* @param info The ValueInfo for this node.
*/
public NodeInfo(String name, ValueInfo info) {
this.name = name;
this.info = info;
}

/**
* The name of the node.
*
* @return The name.
*/
public String getName() {
return name;
}

/**
* The type and shape information of this node.
*
* <p>WARNING: {@link MapInfo} and {@link SequenceInfo} instances returned by this type will have
* insufficient information in them as it's not available from the model without an example
* output.
*
* @return The information of the value.
*/
public ValueInfo getInfo() {
return info;
}

@Override
public String toString() {
return "NodeInfo(name=" + name + ",info=" + info.toString() + ")";
}
}
Loading

0 comments on commit dde4df1

Please sign in to comment.