ThenTerm   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 22
Duplicated Lines 0 %
Metric Value
dl 0
loc 22
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A nnf? 0 3 1
A to_s() 0 4 2
A to_nnf() 0 3 1
A initialize() 0 3 1
A reduce() 0 3 1
1
module PropLogic
2
  class ThenTerm < Term
3
    def initialize(term1, term2)
4
      @terms = [term1, term2].freeze
5
    end
6
7
    def to_s(in_term = false)
8
      str = "#{@terms[0].to_s(true)} => #{@terms[1].to_s(true)}"
9
      in_term ? "( #{str} )" : str
10
    end
11
12
    def nnf?
13
      false
14
    end
15
16
    def to_nnf
17
      (~@terms[0]).to_nnf | @terms[1].to_nnf
18
    end
19
20
    def reduce
21
      to_nnf.reduce
22
    end
23
  end
24
25
end
26