Class: AdLint::Cc1::ComparisonOperator

Inherits:
Operator
  • Object
show all
Defined in:
lib/adlint/cc1/operator.rb

Constant Summary

Constants inherited from Operator

Operator::EQ, Operator::GE, Operator::GT, Operator::LE, Operator::LT, Operator::NE

Instance Method Summary collapse

Methods inherited from Operator

#eql?, #hash, #initialize, #to_s, #to_sym

Constructor Details

This class inherits a constructor from AdLint::Cc1::Operator

Instance Method Details

#for_commutationObject



82
83
84
85
86
87
88
89
90
# File 'lib/adlint/cc1/operator.rb', line 82

def for_commutation
  case self
  when Operator::LT then Operator::GT
  when Operator::GT then Operator::LT
  when Operator::LE then Operator::GE
  when Operator::GE then Operator::LE
  else self
  end
end

#for_complementObject



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/adlint/cc1/operator.rb', line 70

def for_complement
  case self
  when Operator::EQ then Operator::NE
  when Operator::NE then Operator::EQ
  when Operator::LT then Operator::GE
  when Operator::GT then Operator::LE
  when Operator::LE then Operator::GT
  when Operator::GE then Operator::LT
  else self
  end
end