Sha256: cee07ea667f6faf28ebdfdd6545972d1cf404f5b62bc0b3329638bdc49bdce47

Contents?: true

Size: 699 Bytes

Versions: 11

Compression:

Stored size: 699 Bytes

Contents

require_relative 'empty_body'

module DeepCover
  class Node
    module Branch
      def flow_completion_count
        branches.map(&:flow_completion_count).inject(0, :+)
      end

      # Define in sublasses:
      def branches
        raise NotImplementedError
      end

      # Also define flow_entry_count
    end

    class TrivialBranch < Node::EmptyBody
      def initialize(condition, other_branch, position: true)
        @condition = condition
        @other_branch = other_branch
        super(nil, parent: condition.parent, position: position)
      end

      def flow_entry_count
        @condition.flow_completion_count - @other_branch.flow_entry_count
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
deep-cover-0.1.12 lib/deep_cover/node/branch.rb
deep-cover-0.1.11 lib/deep_cover/node/branch.rb
deep-cover-0.1.10 lib/deep_cover/node/branch.rb
deep-cover-0.1.9 lib/deep_cover/node/branch.rb
deep-cover-0.1.8 lib/deep_cover/node/branch.rb
deep-cover-0.1.7 lib/deep_cover/node/branch.rb
deep-cover-0.1.6 lib/deep_cover/node/branch.rb
deep-cover-0.1.5 lib/deep_cover/node/branch.rb
deep-cover-0.1.4 lib/deep_cover/node/branch.rb
deep-cover-0.1.3 lib/deep_cover/node/branch.rb
deep-cover-0.1.2 lib/deep_cover/node/branch.rb