| Total Complexity | 6 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| 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 |
||
| 26 |