Class: AdLint::Cc1::GreaterThanValueDomain

Inherits:
ValueDomain
  • Object
show all
Defined in:
lib/adlint/cc1/domain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ValueDomain

#%, #-, #<=, #<=>, #>, #>=, #_narrow_by_ge, #_narrow_by_le, #_widen_by_eq, #_widen_by_ge, #_widen_by_gt, #_widen_by_le, #_widen_by_lt, #_widen_by_ne, #contain?, #eql?, #hash, #logical_shr?, #narrow, #widen

Methods included from ValueDomainFactory

#_create_intersection, #_create_union, #clear_memos, #equal_to, #greater_than, #greater_than_or_equal_to, #less_than, #less_than_or_equal_to, #not_equal_to, #of_ambiguous, #of_false, #of_intersection, #of_nan, #of_nil, #of_true, #of_undefined, #of_union, #of_unlimited

Constructor Details

#initialize(val, logical_shr) ⇒ GreaterThanValueDomain

Returns a new instance of GreaterThanValueDomain.



4723
4724
4725
4726
4727
4728
4729
4730
# File 'lib/adlint/cc1/domain.rb', line 4723

def initialize(val, logical_shr)
  super(logical_shr)
  if val
    @value = val
  else
    raise ArgumentError, "greater than nil?"
  end
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4732
4733
4734
# File 'lib/adlint/cc1/domain.rb', line 4732

def value
  @value
end

Instance Method Details

#!Object



5347
5348
5349
5350
5351
5352
5353
# File 'lib/adlint/cc1/domain.rb', line 5347

def !
  if @value > 0
    ValueDomain.of_false(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end

#!=(rhs_dom) ⇒ Object



5424
5425
5426
# File 'lib/adlint/cc1/domain.rb', line 5424

def !=(rhs_dom)
  rhs_dom._not_equal_greater_than(self)
end

#&(rhs_dom) ⇒ Object



5168
5169
5170
# File 'lib/adlint/cc1/domain.rb', line 5168

def &(rhs_dom)
  rhs_dom.coerce_to_integer._and_greater_than(coerce_to_integer)
end

#*(rhs_dom) ⇒ Object



5055
5056
5057
# File 'lib/adlint/cc1/domain.rb', line 5055

def *(rhs_dom)
  rhs_dom._mul_greater_than(self)
end

#+(rhs_dom) ⇒ Object



5023
5024
5025
# File 'lib/adlint/cc1/domain.rb', line 5023

def +(rhs_dom)
  rhs_dom._add_greater_than(self)
end

#+@Object



5015
5016
5017
# File 'lib/adlint/cc1/domain.rb', line 5015

def +@
  self
end

#-@Object



5019
5020
5021
# File 'lib/adlint/cc1/domain.rb', line 5019

def -@
  ValueDomain.less_than(-@value, logical_shr?)
end

#/(rhs_dom) ⇒ Object



5099
5100
5101
# File 'lib/adlint/cc1/domain.rb', line 5099

def /(rhs_dom)
  rhs_dom._div_greater_than(self)
end

#<(rhs_dom) ⇒ Object



5355
5356
5357
# File 'lib/adlint/cc1/domain.rb', line 5355

def <(rhs_dom)
  rhs_dom._less_greater_than(self)
end

#<<(rhs_dom) ⇒ Object



5275
5276
5277
# File 'lib/adlint/cc1/domain.rb', line 5275

def <<(rhs_dom)
  rhs_dom.coerce_to_integer._shl_greater_than(coerce_to_integer)
end

#==(rhs_dom) ⇒ Object



5392
5393
5394
# File 'lib/adlint/cc1/domain.rb', line 5392

def ==(rhs_dom)
  rhs_dom._equal_greater_than(self)
end

#>>(rhs_dom) ⇒ Object



5311
5312
5313
# File 'lib/adlint/cc1/domain.rb', line 5311

def >>(rhs_dom)
  rhs_dom.coerce_to_integer._shr_greater_than(coerce_to_integer)
end

#^(rhs_dom) ⇒ Object



5236
5237
5238
# File 'lib/adlint/cc1/domain.rb', line 5236

def ^(rhs_dom)
  rhs_dom.coerce_to_integer._xor_greater_than(coerce_to_integer)
end

#_add_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5039
5040
5041
5042
5043
# File 'lib/adlint/cc1/domain.rb', line 5039

def _add_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes EqualToValueDomain#_add_greater_than.
  rhs_dom + lhs_dom
end

#_add_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5051
5052
5053
# File 'lib/adlint/cc1/domain.rb', line 5051

def _add_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(lhs_dom.value + rhs_dom.value, logical_shr?)
end

#_add_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5045
5046
5047
5048
5049
# File 'lib/adlint/cc1/domain.rb', line 5045

def _add_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes LessThanValueDomain#_add_greater_than.
  rhs_dom + lhs_dom
end

#_add_nil(lhs_dom, rhs_dom = self) ⇒ Object



5027
5028
5029
5030
5031
# File 'lib/adlint/cc1/domain.rb', line 5027

def _add_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes NilValueDomain#_add_greater_than.
  rhs_dom + lhs_dom
end

#_add_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5033
5034
5035
5036
5037
# File 'lib/adlint/cc1/domain.rb', line 5033

def _add_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes UnlimitedValueDomain#_add_greater_than.
  rhs_dom + lhs_dom
end

#_and_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5184
5185
5186
5187
5188
# File 'lib/adlint/cc1/domain.rb', line 5184

def _and_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes EqualToValueDomain#_and_greater_than.
  rhs_dom & lhs_dom
end

#_and_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5196
5197
5198
5199
5200
5201
5202
# File 'lib/adlint/cc1/domain.rb', line 5196

def _and_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value > 0 && rhs_dom.value > 0
    ValueDomain.greater_than(lhs_dom.value & rhs_dom.value, logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end

#_and_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5190
5191
5192
5193
5194
# File 'lib/adlint/cc1/domain.rb', line 5190

def _and_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes LessThanValueDomain#_and_greater_than.
  rhs_dom & lhs_dom
end

#_and_nil(lhs_dom, rhs_dom = self) ⇒ Object



5172
5173
5174
5175
5176
# File 'lib/adlint/cc1/domain.rb', line 5172

def _and_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes NilValueDomain#_and_greater_than.
  rhs_dom & lhs_dom
end

#_and_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5178
5179
5180
5181
5182
# File 'lib/adlint/cc1/domain.rb', line 5178

def _and_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes UnlimitedValueDomain#_and_greater_than.
  rhs_dom & lhs_dom
end

#_contain_equal_to?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4762
4763
4764
# File 'lib/adlint/cc1/domain.rb', line 4762

def _contain_equal_to?(lhs_dom, rhs_dom = self)
  false
end

#_contain_greater_than?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4770
4771
4772
# File 'lib/adlint/cc1/domain.rb', line 4770

def _contain_greater_than?(lhs_dom, rhs_dom = self)
  lhs_dom.value <= rhs_dom.value
end

#_contain_intersection?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4774
4775
4776
# File 'lib/adlint/cc1/domain.rb', line 4774

def _contain_intersection?(lhs_dom, rhs_dom = self)
  lhs_dom.domain_pair.all? { |lhs| lhs.contain_value_domain?(rhs_dom) }
end

#_contain_less_than?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4766
4767
4768
# File 'lib/adlint/cc1/domain.rb', line 4766

def _contain_less_than?(lhs_dom, rhs_dom = self)
  false
end

#_contain_nil?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4754
4755
4756
# File 'lib/adlint/cc1/domain.rb', line 4754

def _contain_nil?(lhs_dom, rhs_dom = self)
  false
end

#_contain_union?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4778
4779
4780
# File 'lib/adlint/cc1/domain.rb', line 4778

def _contain_union?(lhs_dom, rhs_dom = self)
  lhs_dom.domain_pair.any? { |lhs| lhs.contain_value_domain?(rhs_dom) }
end

#_contain_unlimited?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4758
4759
4760
# File 'lib/adlint/cc1/domain.rb', line 4758

def _contain_unlimited?(lhs_dom, rhs_dom = self)
  true
end

#_div_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
# File 'lib/adlint/cc1/domain.rb', line 5119

def _div_equal_to(lhs_dom, rhs_dom = self)
  if rhs_dom.value <= 0
    ValueDomain.of_nan(logical_shr?)
  else
    case
    when lhs_dom.value < 0
      ValueDomain.greater_than(
        lhs_dom.value / rhs_dom.value, logical_shr?
      ).intersection(ValueDomain.less_than(
        0, logical_shr?
      ))
    when lhs_dom.value == 0
      ValueDomain.equal_to(0, logical_shr?)
    when lhs_dom.value > 0
      ValueDomain.greater_than(
        0, logical_shr?
      ).intersection(ValueDomain.less_than(
        lhs_dom.value / rhs_dom.value, logical_shr?
      ))
    end
  end
end

#_div_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
# File 'lib/adlint/cc1/domain.rb', line 5155

def _div_greater_than(lhs_dom, rhs_dom = self)
  if rhs_dom.value < 0
    ValueDomain.of_nan(logical_shr?)
  else
    case
    when lhs_dom.value <= 0
      ValueDomain.less_than(0, logical_shr?)
    when lhs_dom.value > 0
      ValueDomain.greater_than(0, logical_shr?)
    end
  end
end

#_div_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
# File 'lib/adlint/cc1/domain.rb', line 5142

def _div_less_than(lhs_dom, rhs_dom = self)
  if rhs_dom.value < 0
    ValueDomain.of_nan(logical_shr?)
  else
    case
    when lhs_dom.value >= 0
      ValueDomain.greater_than(0, logical_shr?)
    when lhs_dom.value < 0
      ValueDomain.less_than(0, logical_shr?)
    end
  end
end

#_div_nil(lhs_dom, rhs_dom = self) ⇒ Object



5103
5104
5105
5106
5107
5108
5109
# File 'lib/adlint/cc1/domain.rb', line 5103

def _div_nil(lhs_dom, rhs_dom = self)
  if rhs_dom.min_value <= 0
    ValueDomain.of_nan(logical_shr?)
  else
    lhs_dom
  end
end

#_div_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5111
5112
5113
5114
5115
5116
5117
# File 'lib/adlint/cc1/domain.rb', line 5111

def _div_unlimited(lhs_dom, rhs_dom = self)
  if rhs_dom.min_value <= 0
    ValueDomain.of_nan(logical_shr?)
  else
    lhs_dom
  end
end

#_equal_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5408
5409
5410
5411
5412
# File 'lib/adlint/cc1/domain.rb', line 5408

def _equal_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes EqualToValueDomain#_equal_greater_than.
  rhs_dom == lhs_dom
end

#_equal_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5420
5421
5422
# File 'lib/adlint/cc1/domain.rb', line 5420

def _equal_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end

#_equal_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5414
5415
5416
5417
5418
# File 'lib/adlint/cc1/domain.rb', line 5414

def _equal_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes LessThanValueDomain#_equal_greater_than.
  rhs_dom == lhs_dom
end

#_equal_nil(lhs_dom, rhs_dom = self) ⇒ Object



5396
5397
5398
5399
5400
# File 'lib/adlint/cc1/domain.rb', line 5396

def _equal_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes NilValueDomain#_equal_greater_than.
  rhs_dom == lhs_dom
end

#_equal_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5402
5403
5404
5405
5406
# File 'lib/adlint/cc1/domain.rb', line 5402

def _equal_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes UnlimitedValueDomain#_equal_greater_than.
  rhs_dom == lhs_dom
end

#_intersect_equal_to?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4799
4800
4801
4802
4803
4804
# File 'lib/adlint/cc1/domain.rb', line 4799

def _intersect_equal_to?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes
  #       EqualToValueDomain#_intersect_greater_than?.
  rhs_dom.intersect?(lhs_dom)
end

#_intersect_greater_than?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4813
4814
4815
# File 'lib/adlint/cc1/domain.rb', line 4813

def _intersect_greater_than?(lhs_dom, rhs_dom = self)
  true
end

#_intersect_less_than?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4806
4807
4808
4809
4810
4811
# File 'lib/adlint/cc1/domain.rb', line 4806

def _intersect_less_than?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes
  #       LessThanValueDomain#_intersect_greater_than?.
  rhs_dom.intersect?(lhs_dom)
end

#_intersect_nil?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4786
4787
4788
4789
4790
# File 'lib/adlint/cc1/domain.rb', line 4786

def _intersect_nil?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes NilValueDomain#_intersect_greater_than?.
  rhs_dom.intersect?(lhs_dom)
end

#_intersect_unlimited?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


4792
4793
4794
4795
4796
4797
# File 'lib/adlint/cc1/domain.rb', line 4792

def _intersect_unlimited?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_intersect_greater_than?.
  rhs_dom.intersect?(lhs_dom)
end

#_intersection_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5548
5549
5550
5551
5552
5553
# File 'lib/adlint/cc1/domain.rb', line 5548

def _intersection_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes
  #       EqualToValueDomain#_intersection_greater_than.
  rhs_dom.intersection(lhs_dom)
end

#_intersection_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5562
5563
5564
5565
5566
5567
5568
# File 'lib/adlint/cc1/domain.rb', line 5562

def _intersection_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.min_value
    rhs_dom
  else
    lhs_dom
  end
end

#_intersection_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5555
5556
5557
5558
5559
5560
# File 'lib/adlint/cc1/domain.rb', line 5555

def _intersection_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes
  #       LessThanValueDomain#_intersection_greater_than.
  rhs_dom.intersection(lhs_dom)
end

#_intersection_nil(lhs_dom, rhs_dom = self) ⇒ Object



5535
5536
5537
5538
5539
# File 'lib/adlint/cc1/domain.rb', line 5535

def _intersection_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes NilValueDomain#_intersection_greater_than.
  rhs_dom.intersection(lhs_dom)
end

#_intersection_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5541
5542
5543
5544
5545
5546
# File 'lib/adlint/cc1/domain.rb', line 5541

def _intersection_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_intersection_greater_than.
  rhs_dom.intersection(lhs_dom)
end

#_less_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5372
5373
5374
5375
5376
5377
5378
# File 'lib/adlint/cc1/domain.rb', line 5372

def _less_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value < rhs_dom.min_value
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end

#_less_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5388
5389
5390
# File 'lib/adlint/cc1/domain.rb', line 5388

def _less_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end

#_less_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5380
5381
5382
5383
5384
5385
5386
# File 'lib/adlint/cc1/domain.rb', line 5380

def _less_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value < rhs_dom.min_value
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end

#_less_nil(lhs_dom, rhs_dom = self) ⇒ Object



5359
5360
5361
5362
5363
# File 'lib/adlint/cc1/domain.rb', line 5359

def _less_nil(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, any comparison with NilValueDomain makes no sense.
  ValueDomain.of_nil(logical_shr?)
end

#_less_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5365
5366
5367
5368
5369
5370
# File 'lib/adlint/cc1/domain.rb', line 5365

def _less_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: UnlimitedValueDomain contains everything.
  #       So, any comparison with UnlimitedValueDomain makes
  #       UnlimitedValueDomain.
  ValueDomain.of_unlimited(logical_shr?)
end

#_logical_and_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5473
5474
5475
5476
5477
# File 'lib/adlint/cc1/domain.rb', line 5473

def _logical_and_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes EqualToValueDomain#_logical_and_greater_than.
  rhs_dom.logical_and(lhs_dom)
end

#_logical_and_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5486
5487
5488
5489
5490
5491
5492
# File 'lib/adlint/cc1/domain.rb', line 5486

def _logical_and_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= 0 || rhs_dom.min_value <= 0
    ValueDomain.of_unlimited(logical_shr?)
  else
    ValueDomain.of_true(logical_shr?)
  end
end

#_logical_and_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5479
5480
5481
5482
5483
5484
# File 'lib/adlint/cc1/domain.rb', line 5479

def _logical_and_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes
  #       LessThanValueDomain#_logical_and_greater_than.
  rhs_dom.logical_and(lhs_dom)
end

#_logical_and_nil(lhs_dom, rhs_dom = self) ⇒ Object



5460
5461
5462
5463
5464
# File 'lib/adlint/cc1/domain.rb', line 5460

def _logical_and_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes NilValueDomain#_logical_and_greater_than.
  rhs_dom.logical_and(lhs_dom)
end

#_logical_and_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5466
5467
5468
5469
5470
5471
# File 'lib/adlint/cc1/domain.rb', line 5466

def _logical_and_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_logical_and_greater_than.
  rhs_dom.logical_and(lhs_dom)
end

#_logical_or_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5511
5512
5513
5514
5515
# File 'lib/adlint/cc1/domain.rb', line 5511

def _logical_or_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes EqualToValueDomain#_logical_or_greater_than.
  rhs_dom.logical_or(lhs_dom)
end

#_logical_or_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5523
5524
5525
5526
5527
5528
5529
# File 'lib/adlint/cc1/domain.rb', line 5523

def _logical_or_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value > 0 || rhs_dom.value > 0
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end

#_logical_or_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5517
5518
5519
5520
5521
# File 'lib/adlint/cc1/domain.rb', line 5517

def _logical_or_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes LessThanValueDomain#_logical_or_greater_than.
  rhs_dom.logical_or(lhs_dom)
end

#_logical_or_nil(lhs_dom, rhs_dom = self) ⇒ Object



5498
5499
5500
5501
5502
# File 'lib/adlint/cc1/domain.rb', line 5498

def _logical_or_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes NilValueDomain#_logical_or_greater_than.
  rhs_dom.logical_or(lhs_dom)
end

#_logical_or_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5504
5505
5506
5507
5508
5509
# File 'lib/adlint/cc1/domain.rb', line 5504

def _logical_or_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_logical_or_greater_than.
  rhs_dom.logical_or(lhs_dom)
end

#_mul_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5071
5072
5073
5074
5075
# File 'lib/adlint/cc1/domain.rb', line 5071

def _mul_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes EqualToValueDomain#_mul_greater_than.
  rhs_dom * lhs_dom
end

#_mul_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
# File 'lib/adlint/cc1/domain.rb', line 5083

def _mul_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value >= 0
    if rhs_dom.value >= 0
      ValueDomain.greater_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  else
    if rhs_dom.value >= 0
      ValueDomain.of_unlimited(logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  end
end

#_mul_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5077
5078
5079
5080
5081
# File 'lib/adlint/cc1/domain.rb', line 5077

def _mul_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes LessThanValueDomain#_mul_greater_than.
  rhs_dom * lhs_dom
end

#_mul_nil(lhs_dom, rhs_dom = self) ⇒ Object



5059
5060
5061
5062
5063
# File 'lib/adlint/cc1/domain.rb', line 5059

def _mul_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes NilValueDomain#_mul_greater_than.
  rhs_dom * lhs_dom
end

#_mul_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5065
5066
5067
5068
5069
# File 'lib/adlint/cc1/domain.rb', line 5065

def _mul_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes UnlimitedValueDomain#_mul_greater_than.
  rhs_dom * lhs_dom
end

#_narrow_by_eq(rhs_dom, lhs_dom = self) ⇒ Object



4817
4818
4819
# File 'lib/adlint/cc1/domain.rb', line 4817

def _narrow_by_eq(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_greater_than_by_eq(lhs_dom)
end

#_narrow_by_gt(rhs_dom, lhs_dom = self) ⇒ Object



4972
4973
4974
# File 'lib/adlint/cc1/domain.rb', line 4972

def _narrow_by_gt(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_greater_than_by_gt(lhs_dom)
end

#_narrow_by_lt(rhs_dom, lhs_dom = self) ⇒ Object



4919
4920
4921
# File 'lib/adlint/cc1/domain.rb', line 4919

def _narrow_by_lt(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_greater_than_by_lt(lhs_dom)
end

#_narrow_by_ne(rhs_dom, lhs_dom = self) ⇒ Object



4868
4869
4870
# File 'lib/adlint/cc1/domain.rb', line 4868

def _narrow_by_ne(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_greater_than_by_ne(lhs_dom)
end

#_narrow_equal_to_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
# File 'lib/adlint/cc1/domain.rb', line 4832

def _narrow_equal_to_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.value > rhs_dom.value
    # NOTE: Narrowing `---------|---' by `== ---<=========' makes
    #       `---------|---'.
    lhs_dom
  else
    # NOTE: Narrowing `---|---------' by `== ---------<===' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end

#_narrow_equal_to_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



4989
4990
4991
4992
4993
# File 'lib/adlint/cc1/domain.rb', line 4989

def _narrow_equal_to_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `------|------' by `> ------<======' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end

#_narrow_equal_to_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
# File 'lib/adlint/cc1/domain.rb', line 4936

def _narrow_equal_to_by_lt(lhs_dom, rhs_dom = self)
  if lhs_dom.value >= rhs_dom.min_value
    # NOTE: Narrowing `---------|---' by `< ---<=========' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  else
    # NOTE: Narrowing `---|---------' by `< ---------<===' makes
    #       `---|---------'.
    lhs_dom
  end
end

#_narrow_equal_to_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
# File 'lib/adlint/cc1/domain.rb', line 4883

def _narrow_equal_to_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.value >= rhs_dom.min_value
    # NOTE: Narrowing `---|---------' by `!= ---<=========' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  else
    # NOTE: Narrowing `---|---------' by `!= ---------<===' makes
    #       `---|---------'.
    lhs_dom
  end
end

#_narrow_greater_than_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
# File 'lib/adlint/cc1/domain.rb', line 4856

def _narrow_greater_than_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value >= rhs_dom.min_value
    # NOTE: Narrowing `---------<===' by `== ---<=========' makes
    #       `---------<==='.
    lhs_dom
  else
    # NOTE: Narrowing `---<=========' by `== ---------<===' makes
    #       `---------<==='.
    rhs_dom
  end
end

#_narrow_greater_than_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



5001
5002
5003
5004
5005
# File 'lib/adlint/cc1/domain.rb', line 5001

def _narrow_greater_than_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `------<======' by `> ------<======' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end

#_narrow_greater_than_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
# File 'lib/adlint/cc1/domain.rb', line 4960

def _narrow_greater_than_by_lt(lhs_dom, rhs_dom = self)
  if lhs_dom.value < rhs_dom.value
    # NOTE: Narrowing `---<=========' by `< ---------<===' makes
    #       `---<=====>---'.
    lhs_dom.intersect(rhs_dom.inversion)
  else
    # NOTE: Narrowing `---------<===' by `< ---<=========' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end

#_narrow_greater_than_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
# File 'lib/adlint/cc1/domain.rb', line 4907

def _narrow_greater_than_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value >= rhs_dom.min_value
    # NOTE: Narrowing `---------<===' by `!= ---<=========' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  else
    # NOTE: Narrowing `---<=========' by `!= ---------<===' makes
    #       `---<=====>---'.
    lhs_dom.intersection(rhs_dom.inversion)
  end
end

#_narrow_less_than_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
# File 'lib/adlint/cc1/domain.rb', line 4844

def _narrow_less_than_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.value > rhs_dom.value
    # NOTE: Narrowing `=========>---' by `== ---<=========' makes
    #       `---<=====>---'.
    lhs_dom.intersection(rhs_dom)
  else
    # NOTE: Narrowing `===>---------' by `== ---------<===' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end

#_narrow_less_than_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



4995
4996
4997
4998
4999
# File 'lib/adlint/cc1/domain.rb', line 4995

def _narrow_less_than_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `======>------' by `> ------<======' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end

#_narrow_less_than_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
# File 'lib/adlint/cc1/domain.rb', line 4948

def _narrow_less_than_by_lt(lhs_dom, rhs_dom = self)
  if lhs_dom.value > rhs_dom.value
    # NOTE: Narrowing `=========>---' by `< ---<=========' makes
    #       `===>---------'.
    rhs_dom.inversion
  else
    # NOTE: Narrowing `===>---------' by `< ---------<===' makes
    #       `===>---------'.
    lhs_dom
  end
end

#_narrow_less_than_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
# File 'lib/adlint/cc1/domain.rb', line 4895

def _narrow_less_than_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= rhs_dom.min_value
    # NOTE: Narrowing `=========>---' by `!= ---<=========' makes
    #       `===>---------'.
    rhs_dom.inversion
  else
    # NOTE: Narrowing `===>---------' by `!= ---------<===' makes
    #       `===>---------'.
    lhs_dom
  end
end

#_narrow_nil_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



4821
4822
4823
4824
4825
4826
# File 'lib/adlint/cc1/domain.rb', line 4821

def _narrow_nil_by_eq(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, narrowing NilValueDomain by anything makes no effect to the
  #       target value-domain.
  lhs_dom
end

#_narrow_nil_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



4976
4977
4978
4979
4980
4981
# File 'lib/adlint/cc1/domain.rb', line 4976

def _narrow_nil_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, narrowing NilValueDomain by anything makes no effect to the
  #       target value-domain.
  lhs_dom
end

#_narrow_nil_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



4923
4924
4925
4926
4927
4928
# File 'lib/adlint/cc1/domain.rb', line 4923

def _narrow_nil_by_lt(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, narrowing NilValueDomain by anything makes no effect to the
  #       target value-domain.
  lhs_dom
end

#_narrow_nil_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



4872
4873
4874
4875
4876
4877
# File 'lib/adlint/cc1/domain.rb', line 4872

def _narrow_nil_by_ne(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, narrowing NilValueDomain by anything makes no effect to the
  #       target value-domain.
  lhs_dom
end

#_narrow_unlimited_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



4828
4829
4830
# File 'lib/adlint/cc1/domain.rb', line 4828

def _narrow_unlimited_by_eq(lhs_dom, rhs_dom = self)
  rhs_dom
end

#_narrow_unlimited_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



4983
4984
4985
4986
4987
# File 'lib/adlint/cc1/domain.rb', line 4983

def _narrow_unlimited_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `=============' by `> ------<======' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end

#_narrow_unlimited_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



4930
4931
4932
4933
4934
# File 'lib/adlint/cc1/domain.rb', line 4930

def _narrow_unlimited_by_lt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `=============' by `< ------<======' makes
  #       `======>------'.
  rhs_dom.inversion
end

#_narrow_unlimited_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



4879
4880
4881
# File 'lib/adlint/cc1/domain.rb', line 4879

def _narrow_unlimited_by_ne(lhs_dom, rhs_dom = self)
  rhs_dom.inversion
end

#_not_equal_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5440
5441
5442
5443
5444
# File 'lib/adlint/cc1/domain.rb', line 5440

def _not_equal_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes EqualToValueDomain#_not_equal_greater_than.
  rhs_dom != lhs_dom
end

#_not_equal_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5452
5453
5454
# File 'lib/adlint/cc1/domain.rb', line 5452

def _not_equal_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end

#_not_equal_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5446
5447
5448
5449
5450
# File 'lib/adlint/cc1/domain.rb', line 5446

def _not_equal_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes LessThanValueDomain#_not_equal_greater_than.
  rhs_dom != lhs_dom
end

#_not_equal_nil(lhs_dom, rhs_dom = self) ⇒ Object



5428
5429
5430
5431
5432
# File 'lib/adlint/cc1/domain.rb', line 5428

def _not_equal_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes NilValueDomain#_not_equal_greater_than.
  rhs_dom != lhs_dom
end

#_not_equal_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5434
5435
5436
5437
5438
# File 'lib/adlint/cc1/domain.rb', line 5434

def _not_equal_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes UnlimitedValueDomain#_not_equal_greater_than.
  rhs_dom != lhs_dom
end

#_or_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5220
5221
5222
5223
5224
# File 'lib/adlint/cc1/domain.rb', line 5220

def _or_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes EqualToValueDomain#_or_greater_than.
  rhs_dom | lhs_dom
end

#_or_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5232
5233
5234
# File 'lib/adlint/cc1/domain.rb', line 5232

def _or_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end

#_or_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5226
5227
5228
5229
5230
# File 'lib/adlint/cc1/domain.rb', line 5226

def _or_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes LessThanValueDomain#_or_greater_than.
  rhs_dom | lhs_dom
end

#_or_nil(lhs_dom, rhs_dom = self) ⇒ Object



5208
5209
5210
5211
5212
# File 'lib/adlint/cc1/domain.rb', line 5208

def _or_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes NilValueDomain#_or_greater_than.
  rhs_dom | lhs_dom
end

#_or_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5214
5215
5216
5217
5218
# File 'lib/adlint/cc1/domain.rb', line 5214

def _or_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes UnlimitedValueDomain#_or_greater_than.
  rhs_dom | lhs_dom
end

#_shl_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5296
5297
5298
5299
# File 'lib/adlint/cc1/domain.rb', line 5296

def _shl_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(left_shift(lhs_dom.value, rhs_dom.value),
                           logical_shr?)
end

#_shl_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5306
5307
5308
5309
# File 'lib/adlint/cc1/domain.rb', line 5306

def _shl_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(left_shift(lhs_dom.value, rhs_dom.value),
                           logical_shr?)
end

#_shl_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5301
5302
5303
5304
# File 'lib/adlint/cc1/domain.rb', line 5301

def _shl_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(left_shift(lhs_dom.value, rhs_dom.value),
                           logical_shr?)
end

#_shl_nil(lhs_dom, rhs_dom = self) ⇒ Object



5279
5280
5281
5282
5283
5284
# File 'lib/adlint/cc1/domain.rb', line 5279

def _shl_nil(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, any arithmetic operation with NilValueDomain makes
  #       NilValueDomain.
  lhs_dom
end

#_shl_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5286
5287
5288
5289
5290
5291
5292
5293
5294
# File 'lib/adlint/cc1/domain.rb', line 5286

def _shl_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: UnlimitedValueDomain contains everything.
  #       So, this arithmetic operation with UnlimitedValueDomain makes
  #       UnlimitedValueDomain because of the bit-overflow.
  # NOTE: NaN is a subclass of UnlimitedValueDomain.
  #       Arithmetic operation with UnlimitedValueDomain should make
  #       UnlimitedValueDomain, and with NaN should make NaN.
  lhs_dom
end

#_shr_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5332
5333
5334
5335
# File 'lib/adlint/cc1/domain.rb', line 5332

def _shr_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(right_shift(lhs_dom.value, rhs_dom.value),
                        logical_shr?)
end

#_shr_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5342
5343
5344
5345
# File 'lib/adlint/cc1/domain.rb', line 5342

def _shr_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(right_shift(lhs_dom.value, rhs_dom.value),
                        logical_shr?)
end

#_shr_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5337
5338
5339
5340
# File 'lib/adlint/cc1/domain.rb', line 5337

def _shr_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(right_shift(lhs_dom.value, rhs_dom.value),
                        logical_shr?)
end

#_shr_nil(lhs_dom, rhs_dom = self) ⇒ Object



5315
5316
5317
5318
5319
5320
# File 'lib/adlint/cc1/domain.rb', line 5315

def _shr_nil(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, any arithmetic operation with NilValueDomain makes
  #       NilValueDomain.
  lhs_dom
end

#_shr_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5322
5323
5324
5325
5326
5327
5328
5329
5330
# File 'lib/adlint/cc1/domain.rb', line 5322

def _shr_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: UnlimitedValueDomain contains everything.
  #       So, this arithmetic operation with UnlimitedValueDomain makes
  #       UnlimitedValueDomain because of the bit-overflow.
  # NOTE: NaN is a subclass of UnlimitedValueDomain.
  #       Arithmetic operation with UnlimitedValueDomain should make
  #       UnlimitedValueDomain, and with NaN should make NaN.
  lhs_dom
end

#_union_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5586
5587
5588
5589
5590
# File 'lib/adlint/cc1/domain.rb', line 5586

def _union_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes EqualToValueDomain#_union_greater_than.
  rhs_dom.union(lhs_dom)
end

#_union_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5598
5599
5600
5601
5602
5603
5604
# File 'lib/adlint/cc1/domain.rb', line 5598

def _union_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.min_value
    lhs_dom
  else
    rhs_dom
  end
end

#_union_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5592
5593
5594
5595
5596
# File 'lib/adlint/cc1/domain.rb', line 5592

def _union_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes LessThanValueDomain#_union_greater_than.
  rhs_dom.union(lhs_dom)
end

#_union_nil(lhs_dom, rhs_dom = self) ⇒ Object



5574
5575
5576
5577
5578
# File 'lib/adlint/cc1/domain.rb', line 5574

def _union_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes NilValueDomain#_union_greater_than.
  rhs_dom.union(lhs_dom)
end

#_union_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5580
5581
5582
5583
5584
# File 'lib/adlint/cc1/domain.rb', line 5580

def _union_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes UnlimitedValueDomain#_union_greater_than.
  rhs_dom.union(lhs_dom)
end

#_xor_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5252
5253
5254
5255
5256
# File 'lib/adlint/cc1/domain.rb', line 5252

def _xor_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes EqualToValueDomain#_xor_greater_than.
  rhs_dom ^ lhs_dom
end

#_xor_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
# File 'lib/adlint/cc1/domain.rb', line 5264

def _xor_greater_than(lhs_dom, rhs_dom = self)
  case
  when lhs_dom.value > 0 && rhs_dom.value > 0
    ValueDomain.greater_than(0, logical_shr?)
  when lhs_dom.value > 0 || rhs_dom.value > 0
    ValueDomain.less_than(0, logical_shr?)
  else
    ValueDomain.greater_than(0, logical_shr?)
  end
end

#_xor_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5258
5259
5260
5261
5262
# File 'lib/adlint/cc1/domain.rb', line 5258

def _xor_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes LessThanValueDomain#_xor_greater_than.
  rhs_dom ^ lhs_dom
end

#_xor_nil(lhs_dom, rhs_dom = self) ⇒ Object



5240
5241
5242
5243
5244
# File 'lib/adlint/cc1/domain.rb', line 5240

def _xor_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes NilValueDomain#_xor_greater_than.
  rhs_dom ^ lhs_dom
end

#_xor_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5246
5247
5248
5249
5250
# File 'lib/adlint/cc1/domain.rb', line 5246

def _xor_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes UnlimitedValueDomain#_xor_greater_than.
  rhs_dom ^ lhs_dom
end

#ambiguous?Boolean

Returns:

  • (Boolean)


4746
4747
4748
# File 'lib/adlint/cc1/domain.rb', line 4746

def ambiguous?
  false
end

#coerce_to_integerObject



5606
5607
5608
5609
5610
5611
5612
# File 'lib/adlint/cc1/domain.rb', line 5606

def coerce_to_integer
  if @value.integer?
    self
  else
    ValueDomain.greater_than(@value.to_i, logical_shr?)
  end
end

#coerce_to_realObject



5614
5615
5616
5617
5618
5619
5620
# File 'lib/adlint/cc1/domain.rb', line 5614

def coerce_to_real
  if @value.real?
    self
  else
    ValueDomain.greater_than(@value.to_f, logical_shr?)
  end
end

#complexityObject



5652
5653
5654
# File 'lib/adlint/cc1/domain.rb', line 5652

def complexity
  1
end

#contain_value_domain?(rhs_dom) ⇒ Boolean

Returns:

  • (Boolean)


4750
4751
4752
# File 'lib/adlint/cc1/domain.rb', line 4750

def contain_value_domain?(rhs_dom)
  rhs_dom._contain_greater_than?(self)
end

#each_sampleObject



5634
5635
5636
5637
5638
5639
5640
5641
# File 'lib/adlint/cc1/domain.rb', line 5634

def each_sample
  if block_given?
    yield(min_value)
    self
  else
    to_enum(:each_sample)
  end
end

#empty?Boolean

Returns:

  • (Boolean)


4734
4735
4736
# File 'lib/adlint/cc1/domain.rb', line 4734

def empty?
  false
end

#intersect?(rhs_dom) ⇒ Boolean

Returns:

  • (Boolean)


4782
4783
4784
# File 'lib/adlint/cc1/domain.rb', line 4782

def intersect?(rhs_dom)
  rhs_dom._intersect_greater_than?(self)
end

#intersection(rhs_dom) ⇒ Object



5531
5532
5533
# File 'lib/adlint/cc1/domain.rb', line 5531

def intersection(rhs_dom)
  rhs_dom._intersection_greater_than(self)
end

#inversionObject



5007
5008
5009
# File 'lib/adlint/cc1/domain.rb', line 5007

def inversion
  ValueDomain.less_than_or_equal_to(@value, logical_shr?)
end

#logical_and(rhs_dom) ⇒ Object



5456
5457
5458
# File 'lib/adlint/cc1/domain.rb', line 5456

def logical_and(rhs_dom)
  rhs_dom._logical_and_greater_than(self)
end

#logical_or(rhs_dom) ⇒ Object



5494
5495
5496
# File 'lib/adlint/cc1/domain.rb', line 5494

def logical_or(rhs_dom)
  rhs_dom._logical_or_greater_than(self)
end

#max_valueObject



5630
5631
5632
# File 'lib/adlint/cc1/domain.rb', line 5630

def max_value
  nil
end

#min_valueObject



5622
5623
5624
5625
5626
5627
5628
# File 'lib/adlint/cc1/domain.rb', line 5622

def min_value
  if @value.integer?
    @value + 1
  else
    @value + Float::EPSILON
  end
end

#nan?Boolean

Returns:

  • (Boolean)


4738
4739
4740
# File 'lib/adlint/cc1/domain.rb', line 4738

def nan?
  false
end

#to_defined_domainObject



5643
5644
5645
# File 'lib/adlint/cc1/domain.rb', line 5643

def to_defined_domain
  self
end

#to_sObject



5647
5648
5649
# File 'lib/adlint/cc1/domain.rb', line 5647

def to_s
  "(> #{@value})"
end

#undefined?Boolean

Returns:

  • (Boolean)


4742
4743
4744
# File 'lib/adlint/cc1/domain.rb', line 4742

def undefined?
  false
end

#union(rhs_dom) ⇒ Object



5570
5571
5572
# File 'lib/adlint/cc1/domain.rb', line 5570

def union(rhs_dom)
  rhs_dom._union_greater_than(self)
end

#|(rhs_dom) ⇒ Object



5204
5205
5206
# File 'lib/adlint/cc1/domain.rb', line 5204

def |(rhs_dom)
  rhs_dom.coerce_to_integer._or_greater_than(coerce_to_integer)
end

#~Object



5011
5012
5013
# File 'lib/adlint/cc1/domain.rb', line 5011

def ~
  ValueDomain.greater_than(~coerce_to_integer.value, logical_shr?)
end