pacer 1.5.4-java → 1.6.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a36c9ff57450dc2a925ab700058f7e1dee0b2253
4
- data.tar.gz: 4f0b8c63222025399b50a181b641adfd1be2936a
3
+ metadata.gz: 7e492827750d0f50e895dea5a6b847634f5800d7
4
+ data.tar.gz: 21025ddf6898e6f432c9466cf61f3ff04b0d286d
5
5
  SHA512:
6
- metadata.gz: d870f3b0c7e2d191e1a58baf3db06d983fa2b46a7147c9f5b357647f7ca3067b6a5d7cb1391eabe85334224c2a44b489af86ca2423ac6aa56330e73872b46b6c
7
- data.tar.gz: 716b3fb946400740c4cd637b588238967eadc8925e0d53c2424ca255ba76a18912c8071d3652819d639de4d3340cc3e6f802fabddd4326568d61e7914d2288a7
6
+ metadata.gz: e20c5e2ee2b402909c8ade3b8116ea01496d9e2c5947b5cef83abf4680136d78ee05395cc41f18604d49a6e0514ba8538b03b62f3072cedd76beb3e5b3c5bac7
7
+ data.tar.gz: ef58e5ca6852f6b9ed63ce2386c647c1ae378aa416d9e27d4489bcf2546cc1546b0291cffbe676638545967d4b13467c7cea679826e77ea9f8c936c056c24ddf
@@ -6,8 +6,9 @@ module Pacer
6
6
  end
7
7
 
8
8
  def all(opts = {}, &block)
9
+ include_self = opts[:include_self]
9
10
  loop(opts, &block).while do |e, depth|
10
- if depth == 0
11
+ if depth == 0 and not include_self
11
12
  :loop
12
13
  else
13
14
  :loop_and_recur
@@ -60,7 +60,12 @@ module Pacer
60
60
  attr_accessor :search_manual_indices
61
61
 
62
62
  def initialize(graph, filters)
63
- @graph = graph
63
+ if graph.is_a? Pacer::Wrappers::ElementWrapper
64
+ # this can happen if the starting route is actually a single element.
65
+ @graph = graph.graph
66
+ else
67
+ @graph = graph
68
+ end
64
69
  @properties = []
65
70
  @blocks = []
66
71
  @extensions = []
@@ -69,6 +74,27 @@ module Pacer
69
74
  @non_ext_props = []
70
75
  @best_index_value = nil
71
76
  add_filters filters, nil
77
+ combine_sets
78
+ end
79
+
80
+ def combine_sets
81
+ is_set = properties.group_by { |p| p[1].is_a? Set }
82
+ sets = is_set[true] # [["x", Set[]] ...]
83
+ if sets
84
+ is_multi = sets.group_by { |a| a.count > 1 }
85
+ multi = is_multi[true]
86
+ if multi
87
+ multi = multi.group_by { |m| m.first } # {"x": [["x", Set[]], ...]}
88
+ result = multi.map do |multi_set|
89
+ multi_set[1].reduce do |result, pair|
90
+ [result[0], result[1].intersection(pair[1])]
91
+ end
92
+ end
93
+ result = result.concat(is_multi[false]) if is_multi[false]
94
+ result = result.concat(is_set[false]) if is_set[false]
95
+ @properties = result
96
+ end
97
+ end
72
98
  end
73
99
 
74
100
  # Set which graph this filter is currently operating on
@@ -205,7 +231,6 @@ module Pacer
205
231
  when Hash
206
232
  reset_properties
207
233
  filter.each do |k, v|
208
- v = v.first if v.is_a? Set and v.length == 1
209
234
  self.non_ext_props << [k.to_s, v] unless extension
210
235
  self.properties << [k.to_s, v]
211
236
  end
data/lib/pacer/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Pacer
2
2
  unless const_defined? :VERSION
3
- VERSION = "1.5.4"
3
+ VERSION = "1.6.0"
4
4
 
5
5
  JAR = "pacer-#{ VERSION }-standalone.jar"
6
6
  JAR_PATH = "lib/#{ JAR }"
@@ -78,7 +78,7 @@ module Pacer::Wrappers
78
78
  if exts.length == 1 and not exts.first.is_a?(Module) and not exts.first.is_a?(Class) and exts.first
79
79
  # NB: oops, I defined route#as to be the same as route#section. If the signature is
80
80
  # matching the section method, then defer to it.
81
- section *exts
81
+ section exts.first
82
82
  elsif as?(*exts)
83
83
  exts_to_add = extensions_missing(exts)
84
84
  extended = exts_to_add.empty? ? self : add_extensions(exts_to_add)
@@ -103,9 +103,18 @@ module Pacer::Wrappers
103
103
 
104
104
  def as?(*exts)
105
105
  has_exts = extensions_missing(exts).all? do |ext|
106
- if ext.respond_to? :route_conditions
107
- ext.route_conditions(graph).all? do |k, v|
108
- self[k] == v
106
+ rc = if ext.respond_to? :route_conditions
107
+ ext.route_conditions(graph)
108
+ elsif ext.respond_to? :lookup
109
+ ext.lookup(graph)
110
+ end
111
+ if rc
112
+ rc.all? do |k, v|
113
+ if v.is_a? Set
114
+ v.include? self[k]
115
+ else
116
+ self[k] == v
117
+ end
109
118
  end
110
119
  else
111
120
  true
data/pom.xml CHANGED
@@ -8,7 +8,7 @@
8
8
  <!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
9
9
  <properties>
10
10
  <blueprints.version>2.6.0</blueprints.version>
11
- <gem.version>1.5.4</gem.version>
11
+ <gem.version>1.6.0</gem.version>
12
12
  <pipes.version>2.5.0</pipes.version>
13
13
  </properties>
14
14
  <!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
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: 1.5.4
4
+ version: 1.6.0
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-10-04 00:00:00.000000000 Z
11
+ date: 2014-11-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pacer defines routes through a graph and then traverses them very quickly.
14
14
  email: darrick@innatesoftware.com
@@ -218,7 +218,7 @@ files:
218
218
  - spec/support/use_transactions.rb
219
219
  - spec/tackle/simple_mixin.rb
220
220
  - spec/tackle/tinkerpop_graph_mixins.rb
221
- - lib/pacer-1.5.4-standalone.jar
221
+ - lib/pacer-1.6.0-standalone.jar
222
222
  homepage: http://github.com/pangloss/pacer
223
223
  licenses:
224
224
  - MIT