You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added P.typeOf() predicate, which recognized a new set of GType enum token, String as registered in the GlobalTypeCache, as well as Class in Java/Groovy usage. (#3211)
Copy file name to clipboardExpand all lines: CHANGELOG.asciidoc
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,8 @@ This release also includes changes from <<release-3-7-XXX, 3.7.XXX>>.
91
91
* Deprecated `ProcessLimitedStandardSuite` and `ProcessLimitedComputerSuite` in favor of `ProcessEmbeddedStandardSuite` and `ProcessEmbeddedComputerSuite` respectively.
92
92
* Deprecated `ProcessStandardSuite` and the `ProcessComputerSuite` in favor of Gherkin testing and the `ProcessEmbeddedStandardSuite` and `ProcessEmbeddedComputerSuite` for testing JVM-specific Gremlin behaviors.
93
93
* Removed lambda oriented Gremlin testing from Gherkin test suite.
94
+
* Implemented `P.typeOf()` predicate.
95
+
* Added `GType` enum to denote types.
94
96
* Removed `P.getOriginalValue()` in favor of `P.getValue()`.
95
97
* Simplified comparability semantics from ternary boolean logic to binary logic.
*Description:* converts the incoming traverser to the nearest parsable type if no argument is provided, or to the desired numerical type, based on the number token (`N`) provided.
The `asNumber()`-step (*map*) converts the incoming traverser to the nearest parsable type if no argument is provided,
857
-
or to the desired numerical type, based on the number token (`N`) provided.
857
+
or to the desired numerical type, based on the type token (`GType`) provided. If a type token entered isn't a numerical type, an `IllegalArgumentException` will be thrown.
858
858
859
859
Numerical input will pass through unless a type is specified by the number token. `ArithmeticException` will be thrown
860
860
for any overflow during narrowing of types.
@@ -868,17 +868,13 @@ All other input types will result in `IllegalArgumentException`.
868
868
[gremlin-groovy,modern]
869
869
----
870
870
g.inject(1234).asNumber() <1>
871
-
g.inject(1.76).asNumber() <2>
872
-
g.inject(1.76).asNumber(N.int_) <3>
873
-
g.inject("1b").asNumber() <4>
874
-
g.inject(33550336).asNumber(N.byte_) <5>
871
+
g.inject(1.76d).asNumber() <2>
872
+
g.inject(1.76d).asNumber(GType.INT) <3>
875
873
----
876
874
877
875
<1> An int will be passed through.
878
876
<2> A double will be passed through.
879
877
<3> A double is converted into an int.
880
-
<4> String containing any character other than numerical ones will result in `NumberFormatException`.
881
-
<5> Narrowing of int to byte that overflows will throw `ArithmeticException`.
882
878
883
879
[NOTE, caption=Java]
884
880
====
@@ -5477,12 +5473,8 @@ a comparatively slow script compilation, which makes parameterization essential
5477
5473
[[a-note-on-predicates]]
5478
5474
== A Note on Predicates
5479
5475
5480
-
A `P` is a predicate of the form `Function<Object,Boolean>`. That is, given some object, return true or false. As of
5481
-
the release of TinkerPop 3.4.0, Gremlin also supports simple text predicates, which only work on `String` values. The `TextP`
5482
-
text predicates extend the `P` predicates, but are specialized in that they are of the form `Function<String,Boolean>`.
5483
-
The provided predicates are outlined in the table below and are used in various steps such as <<has-step,`has()`>>-step,
5484
-
<<where-step,`where()`>>-step, <<is-step,`is()`>>-step, etc. Two new additional `TextP` predicate members were added in the
5485
-
TinkerPop 3.6.0 release that allow working with regular expressions. These are `TextP.regex` and `TextP.notRegex`
5476
+
A `P` is a predicate of the form `Function<Object,Boolean>`. That is, given some object, return true or false. Gremlin
5477
+
supports text predicates (`TextP`), which are specialized predicates that only work on String values and are of the form `Function<String,Boolean>`. Additionally, type predicate (`P.typeOf`) supports filtering traversers based on their runtime types. The provided predicates are outlined in the table below and are used in various steps such as <<has-step,`has()`>>-step, <<where-step,`where()`>>-step, <<is-step,`is()`>>-step, etc.
0 commit comments