forked from pangloss/pacer
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/loop' into develop
* feature/loop: (44 commits) The test suite is back to 100%. Fix the creation of SideEffectCapPipe directly after the sources. Don't need to check the type of each yielded object in BlockFilterPipe or MapPipe any longer. don't try add_extensions on plain objects. Figured out how to raise the correct exception to keep Java Pipes happy. Use a common method to throw pipe exception. Hopefully I'll find a technique that Java will actually be able to catch. Update method names in rebuild_automatic_index for interface changes in Blueprints. Add Utils::Trie as a little experiment with looping pipes. Allow to_route with specified :element_type Improve exceptions in route creation. Use the LabelPipe Labels now returns a route. AutoIndexKeysInUse is actually not necessary. Revert changes to block filter pipe. I can actually do #count with the counted pipe. Better inspect strings. Optional args when adding to expandable pipe. GroupPipe -- not sure about this yet but I think it will be useful if I can get it right. another missed require.. Changed to #collect everywhere because #map row uses the MapPipe. ... Conflicts: lib/pacer/pipe/stream_sort_pipe.rb lib/pacer/pipes.rb lib/pacer/route/branched_route.rb spec/pacer/route/branched_route_spec.rb
- Loading branch information
Showing
50 changed files
with
880 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ module Core | |
|
||
require 'pacer/core/route' | ||
require 'pacer/core/graph' | ||
require 'pacer/core/side_effect' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Pacer | ||
module Core | ||
module SideEffect | ||
def side_effect | ||
@pipe.getSideEffect | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
module Pacer | ||
module Routes | ||
module RouteOperations | ||
public | ||
|
||
def loop(&block) | ||
chain_route :looping_route => block | ||
end | ||
end | ||
end | ||
|
||
module Filter | ||
module LoopFilter | ||
def self.triggers | ||
[:looping_route] | ||
end | ||
|
||
attr_reader :looping_route | ||
|
||
def looping_route=(route) | ||
if route.is_a? Proc | ||
empty = Pacer::Route.new :filter => :empty, :back => self | ||
@looping_route = route.call(empty) | ||
else | ||
@looping_route = route | ||
end | ||
end | ||
|
||
def while(yield_paths = false, &block) | ||
@yield_paths = yield_paths | ||
@control_block = block | ||
self | ||
end | ||
|
||
protected | ||
|
||
def iterator | ||
iter = super | ||
iter.enable_path if @yield_paths | ||
iter | ||
end | ||
|
||
def attach_pipe(end_pipe) | ||
unless @control_block | ||
raise 'No loop control block specified. Use either #while or #until after #loop.' | ||
end | ||
pipe = Pacer::Pipes::LoopPipe.new(looping_pipe, @control_block) | ||
pipe.setStarts(end_pipe) | ||
pipe | ||
end | ||
|
||
def looping_pipe | ||
s, e = looping_route.send(:build_pipeline) | ||
if s.equal?(e) | ||
s | ||
else | ||
Pacer::Pipes::Pipeline.new s, e | ||
end | ||
end | ||
|
||
def inspect_string | ||
"#{ inspect_class_name }(#{ @looping_route.inspect })" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,6 @@ def display_name | |
end | ||
end | ||
|
||
|
||
# Deletes the edge from its graph. | ||
def delete! | ||
graph.remove_edge element | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.