-
Notifications
You must be signed in to change notification settings - Fork 830
TINKERPOP-3166 Implement asNumber() step #3153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 3.8-dev
Are you sure you want to change the base?
Changes from 8 commits
e4ec141
8bee410
01c2d78
20827f8
7ef100a
66294ec
edd6f81
c3d5762
0ae19cd
13a51e9
b59199b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
import org.apache.tinkerpop.gremlin.language.grammar.GremlinParser; | ||
import org.apache.tinkerpop.gremlin.process.traversal.DT; | ||
import org.apache.tinkerpop.gremlin.process.traversal.Merge; | ||
import org.apache.tinkerpop.gremlin.process.traversal.N; | ||
import org.apache.tinkerpop.gremlin.process.traversal.Operator; | ||
import org.apache.tinkerpop.gremlin.process.traversal.Order; | ||
import org.apache.tinkerpop.gremlin.process.traversal.P; | ||
|
@@ -207,6 +208,12 @@ public Void visitTraversalDT(final GremlinParser.TraversalDTContext ctx) { | |
return null; | ||
} | ||
|
||
@Override | ||
public Void visitTraversalN(final GremlinParser.TraversalNContext ctx) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a few cases to GremlinTranslatorTest to ensure |
||
appendExplicitNaming(ctx.getText(), N.class.getSimpleName()); | ||
return null; | ||
} | ||
|
||
@Override | ||
public Void visitTraversalPredicate(final GremlinParser.TraversalPredicateContext ctx) { | ||
switch(ctx.getChildCount()) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.tinkerpop.gremlin.process.traversal; | ||
|
||
import org.apache.tinkerpop.gremlin.process.traversal.step.map.AsNumberStep; | ||
|
||
import java.math.BigDecimal; | ||
import java.math.BigInteger; | ||
|
||
/** | ||
* Tokens that are used to denote different units of number. | ||
* Used with {@link AsNumberStep} step. | ||
*/ | ||
public enum N { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Radical idea at this point but does |
||
nbyte(Byte.class), | ||
nshort(Short.class), | ||
nint(Integer.class), | ||
nlong(Long.class), | ||
nfloat(Float.class), | ||
ndouble(Double.class), | ||
nbigInt(BigInteger.class), | ||
nbigDecimal(BigDecimal.class),; | ||
|
||
private final Class<?> type; | ||
|
||
N(Class<?> type) {this.type = type;} | ||
|
||
public Class<?> getType() { | ||
return this.type; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.type.getSimpleName(); | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.