pacer 2.0.6-java → 2.0.8-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c92a63098a4721ec7d8222ca84f2a590d401763d
4
- data.tar.gz: 998c4250d82f63e8b5dd6eab0f709cdff4162637
3
+ metadata.gz: c0b27e7056c085d06d70c2db107cd0239823a4f0
4
+ data.tar.gz: 5bc325c8320ff437df42b11b6a57fa345d6b1773
5
5
  SHA512:
6
- metadata.gz: 97833f79fd88d8aea018e19b124d9b7366e3ae682c01073bc1dc8aeb259d1266c431e99039367d7404a94c6b4f50d266e6513230cfa0768d7e4213b3e4bc72ea
7
- data.tar.gz: ddb0377e083bc3ac020908b3870e1f59456824c313fd4607c191b4c183eec66bceaefd59fceac5f3be130f70394ae3b633d1d7b02a9aa04a52e354c1119b3f4b
6
+ metadata.gz: 5e33c21a0e47cbfb77f00c5b783aaf109496798c30111399d064c8d3b2f06826dad478728c15a2561ec24033caae4399602a26ffa0e8480e0e477c0ea205f625
7
+ data.tar.gz: 44e61dfd1fe738cb39f88577f4c9edf402b714a1f125ed8549899fbd98b7df72b375acf9a36d9d843daac50ba16a981d950f602689f6305fc71f0be446ae1565
data/Jarfile CHANGED
@@ -1,2 +1,2 @@
1
1
  jar "com.tinkerpop.blueprints:blueprints-core:2.6.0"
2
- jar "com.tinkerpop:pipes:2.5.0"
2
+ jar "com.tinkerpop:pipes:2.6.0"
@@ -0,0 +1,123 @@
1
+ module Pacer
2
+ module Routes
3
+ module RouteOperations
4
+ def java_loop(opts = {}, &block)
5
+ chain_route(opts.merge :filter => Pacer::Filter::JavaLoopFilter, :looping_route => block)
6
+ end
7
+
8
+ def all(opts = {}, &block)
9
+ if opts[:include_self]
10
+ branch do |this|
11
+ this
12
+ end.branch do |this|
13
+ this.java_loop(opts, &block)
14
+ end.merge_exhaustive
15
+ else
16
+ java_loop(opts, &block)
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ module Filter
23
+ module JavaLoopFilter
24
+ import com.tinkerpop.pipes.branch.LoopPipe
25
+
26
+ attr_reader :looping_route
27
+
28
+ def looping_route=(route)
29
+ if route.is_a? Proc
30
+ @looping_route = Pacer::Route.block_branch(self, route)
31
+ else
32
+ @looping_route = route
33
+ end
34
+ end
35
+
36
+ def emit(always = false, &block)
37
+ if always
38
+ @emit_fn = proc { true }
39
+ else
40
+ @emit_fn = LoopPipeFunction.new graph, element_wrapper, block
41
+ end
42
+ self
43
+ end
44
+
45
+ def loop(always = false, &block)
46
+ if always
47
+ @loop_fn = proc { true }
48
+ else
49
+ @loop_fn = LoopPipeFunction.new graph, element_wrapper, block
50
+ end
51
+ self
52
+ end
53
+
54
+ protected
55
+
56
+ def attach_pipe(end_pipe)
57
+ pipe = LoopPipe.new(looping_pipe, loop_fn, emit_fn)
58
+ pipe.setStarts(end_pipe) if end_pipe
59
+ pipe
60
+ end
61
+
62
+ private
63
+
64
+ def loop_fn
65
+ @loop_fn || proc { true }
66
+ end
67
+
68
+ def emit_fn
69
+ @emit_fn || proc { true }
70
+ end
71
+
72
+ def element_wrapper
73
+ if back
74
+ Pacer::Wrappers::WrapperSelector.build graph, back.element_type, back.extensions
75
+ else
76
+ Pacer::Wrappers::WrapperSelector.build graph
77
+ end
78
+ end
79
+
80
+ def looping_pipe
81
+ Pacer::Route.pipeline(looping_route)
82
+ end
83
+
84
+ class LoopPipeFunction
85
+ attr_reader :graph, :wrapper, :block
86
+
87
+ def initialize(graph, wrapper, block)
88
+ @graph = graph
89
+ @wrapper = wrapper
90
+ @block = block
91
+ end
92
+
93
+ def compute(loop_bundle)
94
+ !!(block.call LoopBundleWrapper.new(graph, wrapper, loop_bundle))
95
+ end
96
+ end
97
+
98
+ class LoopBundleWrapper
99
+ attr_reader :graph, :wrapper, :loop_bundle
100
+
101
+ def initialize(graph, wrapper, loop_bundle)
102
+ @graph = graph
103
+ @wrapper = wrapper
104
+ @loop_bundle = loop_bundle
105
+ end
106
+
107
+ def path
108
+ wrap = Pacer::Wrappers::WrapperSelector.new
109
+ loop_bundle.getPath.map { |el| wrap.new graph, el }
110
+ end
111
+
112
+ def depth
113
+ loop_bundle.getLoops - 1
114
+ end
115
+
116
+ def element
117
+ obj = loop_bundle.getObject
118
+ wrapper.new graph, obj if obj
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
@@ -2,18 +2,7 @@ module Pacer
2
2
  module Routes
3
3
  module RouteOperations
4
4
  def loop(opts = {}, &block)
5
- chain_route(opts.merge :filter => :loop, :looping_route => block)
6
- end
7
-
8
- def all(opts = {}, &block)
9
- include_self = opts[:include_self]
10
- loop(opts, &block).while do |e, depth|
11
- if depth == 0 and not include_self
12
- :loop
13
- else
14
- :loop_and_recur
15
- end
16
- end
5
+ chain_route(opts.merge :filter => Pacer::Filter::LoopFilter, :looping_route => block)
17
6
  end
18
7
 
19
8
  def deepest(&block)
@@ -74,6 +74,7 @@ require 'pacer/filter/range_filter'
74
74
  require 'pacer/filter/uniq_filter'
75
75
  require 'pacer/filter/index_filter'
76
76
  require 'pacer/filter/loop_filter'
77
+ require 'pacer/filter/java_loop_filter'
77
78
  require 'pacer/filter/block_filter'
78
79
  require 'pacer/filter/object_filter'
79
80
  require 'pacer/filter/random_filter'
@@ -1,5 +1,5 @@
1
1
  module Pacer
2
- VERSION = "2.0.6"
2
+ VERSION = "2.0.8"
3
3
  # Clients may optionally define the following constants in the Pacer namespace:
4
4
  # - LOAD_JARS : set to false to manage jar loading in the client. Be sure to load the jars defined in JARFILES.
5
5
  # - LOCKJAR_LOCK_OPTS : set some options to be passed to LockJar.lock (ie. :lockfile, :download_artifacts, :local_repo)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pacer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.8
5
5
  platform: java
6
6
  authors:
7
7
  - Darrick Wiebe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-26 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lock_jar
@@ -52,7 +52,6 @@ files:
52
52
  - CONTRIBUTORS
53
53
  - Gemfile
54
54
  - Gemfile-custom.sample
55
- - Gemfile-custom.x
56
55
  - Jarfile
57
56
  - LICENSE.txt
58
57
  - README.md
@@ -90,6 +89,7 @@ files:
90
89
  - lib/pacer/filter/empty_filter.rb
91
90
  - lib/pacer/filter/future_filter.rb
92
91
  - lib/pacer/filter/index_filter.rb
92
+ - lib/pacer/filter/java_loop_filter.rb
93
93
  - lib/pacer/filter/limit_section_filter.rb
94
94
  - lib/pacer/filter/loop_filter.rb
95
95
  - lib/pacer/filter/object_filter.rb
@@ -1,42 +0,0 @@
1
- group :development do
2
- # pacer-* gems are required for testing pacer.
3
- # If you have the gem repos cloned locally, we'll use them.
4
- #
5
- # Note: when testing orient, use the jruby --headless option to prevent the ui window BS.
6
- [ 'pacer-orient', 'pacer-dex' ].each do |lib|
7
- if File.directory? "../#{lib}"
8
- gem lib, :path => "../#{lib}"
9
- end
10
- end
11
-
12
- # Neo4j versions are mutually incompatible
13
- # To test Pacer against Neo4j 1.x when the neo2 gem is present, use:
14
- #
15
- # neo=1 bundle
16
- # rspec
17
- #
18
- # To switch back, just use:
19
- #
20
- # bundle
21
- # rspec
22
- #
23
-
24
- neo_test_ver = ENV.fetch('neo') do
25
- if File.directory?("../pacer-neo4j2")
26
- '2'
27
- elsif File.directory?("../pacer-neo4j")
28
- '1'
29
- else
30
- '0'
31
- end
32
- end
33
- if neo_test_ver == '1'
34
- gem 'pacer-neo4j', :path => "../pacer-neo4j"
35
- elsif neo_test_ver == '2'
36
- gem 'pacer-neo4j2', :path => "../pacer-neo4j2"
37
- end
38
-
39
- if File.directory? "../mcfly"
40
- gem 'pacer-mcfly', :path => "../mcfly"
41
- end
42
- end