Class: Bio::AssemblyGraphAlgorithms::SingleCoherentPathsBetweenNodesFinder::DualStack
- Inherits:
-
Object
- Object
- Bio::AssemblyGraphAlgorithms::SingleCoherentPathsBetweenNodesFinder::DualStack
- Defined in:
- lib/assembly/single_coherent_paths_between_nodes.rb
Instance Method Summary collapse
-
#initialize(&block) ⇒ DualStack
constructor
A new instance of DualStack.
- #pop ⇒ Object
- #push(to_push) ⇒ Object
- #sizes ⇒ Object
Constructor Details
#initialize(&block) ⇒ DualStack
Returns a new instance of DualStack.
347 348 349 350 351 |
# File 'lib/assembly/single_coherent_paths_between_nodes.rb', line 347 def initialize(&block) @checker = block @stack = DS::Stack.new @dual_stack = DS::Stack.new end |
Instance Method Details
#pop ⇒ Object
361 362 363 |
# File 'lib/assembly/single_coherent_paths_between_nodes.rb', line 361 def pop @stack.pop || @dual_stack.pop end |
#push(to_push) ⇒ Object
353 354 355 356 357 358 359 |
# File 'lib/assembly/single_coherent_paths_between_nodes.rb', line 353 def push to_push if @checker.call to_push @dual_stack.push to_push else @stack.push to_push end end |
#sizes ⇒ Object
365 366 367 |
# File 'lib/assembly/single_coherent_paths_between_nodes.rb', line 365 def sizes return @stack.size, @dual_stack.size end |