mikepersonick commented on a change in pull request #1557:
URL: https://github.com/apache/tinkerpop/pull/1557#discussion_r802762709
##########
File path:
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/translator/GroovyTranslator.java
##########
@@ -419,24 +426,30 @@ protected Script produceScript(final Vertex o) {
@Override
protected String getSyntax(final Number o) {
+ if (o instanceof Double || o instanceof Float) {
+ if (NumberHelper.isNaN(o))
+ return "NaN";
+ if (NumberHelper.isPositiveInfinity(o))
+ return "Infinity";
+ if (NumberHelper.isNegativeInfinity(o))
+ return "-Infinity";
+
+ return o + (o instanceof Double ? "D" : "F");
+ }
if (o instanceof Long)
return o + "L";
- else if (o instanceof Double)
- return o + "D";
- else if (o instanceof Float)
- return o + "F";
- else if (o instanceof Integer)
+ if (o instanceof Integer)
return o + "I";
- else if (o instanceof Byte)
Review comment:
I was seeing a mix and match of cases with and without else so I just
got rid of all of them. In this case it's fine since every case is a return
statement. This would be a lot cleaner in a more modern version of Java where
we could use a switch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]