@@ -13,8 +13,7 @@ import java.util.{
1313 Map => JMap ,
1414 Collection => JCollection ,
1515 Iterator => JIterator ,
16- Set => JSet ,
17- UUID
16+ Set => JSet
1817}
1918import java .util .stream .{Stream => JStream }
2019
@@ -33,7 +32,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.{Bytecode, Path, Scope, Tr
3332import org .apache .tinkerpop .gremlin .structure .{Direction , T }
3433import shapeless .{:: , HList , HNil }
3534import shapeless .ops .hlist .{IsHCons , Mapper , Prepend , RightFolder , ToTraversable , Tupler }
36- import shapeless .ops .tuple .{Prepend => TuplePrepend }
3735import shapeless .ops .product .ToHList
3836import shapeless .syntax .std .tuple ._
3937import scala .concurrent .duration .FiniteDuration
@@ -120,7 +118,7 @@ class GremlinScala[End](val traversal: GraphTraversal[_, End]) {
120118 GremlinScala [JMap [String , A ], Labels ](traversal.project(projectKey, otherProjectKeys : _* ))
121119
122120 def project [H <: Product ](
123- builder : ProjectionBuilder [Nil .type ] ⇒ ProjectionBuilder [H ]): GremlinScala [H ] =
121+ builder : ProjectionBuilder [Nil .type ] => ProjectionBuilder [H ]): GremlinScala [H ] =
124122 builder(ProjectionBuilder ()).build(this )
125123
126124 /** You might think that predicate should be `GremlinScala[End] => GremlinScala[Boolean]`,
@@ -1034,28 +1032,3 @@ class GremlinScala[End](val traversal: GraphTraversal[_, End]) {
10341032 travs.map(_.apply(start).traversal)
10351033
10361034}
1037-
1038- class ProjectionBuilder [T <: Product ] private [gremlin] (
1039- labels : Seq [String ],
1040- addBy : GraphTraversal [_, JMap [String , Any ]] ⇒ GraphTraversal [_, JMap [String , Any ]],
1041- buildResult : JMap [String , Any ] ⇒ T ) {
1042-
1043- def apply [U , TR <: Product ](by : By [U ])(
1044- implicit prepend : TuplePrepend .Aux [T , Tuple1 [U ], TR ]): ProjectionBuilder [TR ] = {
1045- val label = UUID .randomUUID().toString
1046- new ProjectionBuilder [TR ](labels :+ label,
1047- addBy.andThen(by.apply),
1048- map ⇒ buildResult(map) :+ map.get(label).asInstanceOf [U ])
1049- }
1050-
1051- def and [U , TR <: Product ](by : By [U ])(
1052- implicit prepend : TuplePrepend .Aux [T , Tuple1 [U ], TR ]): ProjectionBuilder [TR ] = apply(by)
1053-
1054- private [gremlin] def build (g : GremlinScala [_]): GremlinScala [T ] = {
1055- GremlinScala (addBy(g.traversal.project(labels.head, labels.tail: _* ))).map(buildResult)
1056- }
1057- }
1058-
1059- object ProjectionBuilder {
1060- def apply () = new ProjectionBuilder [Nil .type ](Nil , scala.Predef .identity, _ ⇒ Nil )
1061- }
0 commit comments