Class: AdLint::Cc1::CompositeValueDomain

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

Direct Known Subclasses

IntersectionValueDomain, UnionValueDomain

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ValueDomain

#!, #%, #&, #*, #+, #+@, #-, #-@, #/, #<, #<<, #<=, #<=>, #>, #>=, #>>, #^, #_contain_equal_to?, #_contain_greater_than?, #_contain_intersection?, #_contain_less_than?, #_contain_nil?, #_contain_union?, #_contain_unlimited?, #_mul_equal_to, #_mul_greater_than, #_mul_less_than, #_mul_nil, #_mul_unlimited, #_narrow_by_ge, #_narrow_by_le, #_widen_by_eq, #_widen_by_ge, #_widen_by_gt, #_widen_by_le, #_widen_by_lt, #_widen_by_ne, #coerce_to_integer, #coerce_to_real, #contain?, #contain_value_domain?, #each_sample, #eql?, #hash, #intersect?, #intersection, #inversion, #logical_and, #logical_or, #logical_shr?, #max_value, #min_value, #narrow, #to_s, #union, #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(lhs_dom, rhs_dom) ⇒ CompositeValueDomain



5658
5659
5660
5661
# File 'lib/adlint/cc1/domain.rb', line 5658

def initialize(lhs_dom, rhs_dom)
  super(lhs_dom.logical_shr? && rhs_dom.logical_shr?)
  @domain_pair = [lhs_dom, rhs_dom].sort
end

Instance Attribute Details

#domain_pairObject (readonly)

Returns the value of attribute domain_pair.



5663
5664
5665
# File 'lib/adlint/cc1/domain.rb', line 5663

def domain_pair
  @domain_pair
end

Instance Method Details

#!=(rhs_dom) ⇒ Object



6077
6078
6079
# File 'lib/adlint/cc1/domain.rb', line 6077

def !=(rhs_dom)
  _not_equal(rhs_dom, self)
end

#==(rhs_dom) ⇒ Object



6053
6054
6055
# File 'lib/adlint/cc1/domain.rb', line 6053

def ==(rhs_dom)
  _equal(rhs_dom, self)
end

#_add_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5865
5866
5867
5868
5869
# File 'lib/adlint/cc1/domain.rb', line 5865

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

#_add_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5877
5878
5879
5880
5881
# File 'lib/adlint/cc1/domain.rb', line 5877

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

#_add_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5871
5872
5873
5874
5875
# File 'lib/adlint/cc1/domain.rb', line 5871

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

#_add_nil(lhs_dom, rhs_dom = self) ⇒ Object



5853
5854
5855
5856
5857
# File 'lib/adlint/cc1/domain.rb', line 5853

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

#_add_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5859
5860
5861
5862
5863
# File 'lib/adlint/cc1/domain.rb', line 5859

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

#_and_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5915
5916
5917
5918
5919
# File 'lib/adlint/cc1/domain.rb', line 5915

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

#_and_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5927
5928
5929
5930
5931
# File 'lib/adlint/cc1/domain.rb', line 5927

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

#_and_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5921
5922
5923
5924
5925
# File 'lib/adlint/cc1/domain.rb', line 5921

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

#_and_nil(lhs_dom, rhs_dom = self) ⇒ Object



5903
5904
5905
5906
5907
# File 'lib/adlint/cc1/domain.rb', line 5903

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

#_and_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5909
5910
5911
5912
5913
# File 'lib/adlint/cc1/domain.rb', line 5909

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

#_div_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5891
5892
5893
# File 'lib/adlint/cc1/domain.rb', line 5891

def _div_equal_to(lhs_dom, rhs_dom = self)
  _div(lhs_dom, rhs_dom)
end

#_div_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5899
5900
5901
# File 'lib/adlint/cc1/domain.rb', line 5899

def _div_greater_than(lhs_dom, rhs_dom = self)
  _div(lhs_dom, rhs_dom)
end

#_div_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5895
5896
5897
# File 'lib/adlint/cc1/domain.rb', line 5895

def _div_less_than(lhs_dom, rhs_dom = self)
  _div(lhs_dom, rhs_dom)
end

#_div_nil(lhs_dom, rhs_dom = self) ⇒ Object



5883
5884
5885
# File 'lib/adlint/cc1/domain.rb', line 5883

def _div_nil(lhs_dom, rhs_dom = self)
  _div(lhs_dom, rhs_dom)
end

#_div_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5887
5888
5889
# File 'lib/adlint/cc1/domain.rb', line 5887

def _div_unlimited(lhs_dom, rhs_dom = self)
  _div(lhs_dom, rhs_dom)
end

#_equal_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



6065
6066
6067
# File 'lib/adlint/cc1/domain.rb', line 6065

def _equal_equal_to(lhs_dom, rhs_dom = self)
  _equal(lhs_dom, rhs_dom)
end

#_equal_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



6073
6074
6075
# File 'lib/adlint/cc1/domain.rb', line 6073

def _equal_greater_than(lhs_dom, rhs_dom = self)
  _equal(lhs_dom, rhs_dom)
end

#_equal_less_than(lhs_dom, rhs_dom = self) ⇒ Object



6069
6070
6071
# File 'lib/adlint/cc1/domain.rb', line 6069

def _equal_less_than(lhs_dom, rhs_dom = self)
  _equal(lhs_dom, rhs_dom)
end

#_equal_nil(lhs_dom, rhs_dom = self) ⇒ Object



6057
6058
6059
# File 'lib/adlint/cc1/domain.rb', line 6057

def _equal_nil(lhs_dom, rhs_dom = self)
  _equal(lhs_dom, rhs_dom)
end

#_equal_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



6061
6062
6063
# File 'lib/adlint/cc1/domain.rb', line 6061

def _equal_unlimited(lhs_dom, rhs_dom = self)
  _equal(lhs_dom, rhs_dom)
end

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



5693
5694
5695
5696
5697
# File 'lib/adlint/cc1/domain.rb', line 5693

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

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



5705
5706
5707
5708
5709
# File 'lib/adlint/cc1/domain.rb', line 5705

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

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



5699
5700
5701
5702
5703
# File 'lib/adlint/cc1/domain.rb', line 5699

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

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



5681
5682
5683
5684
5685
# File 'lib/adlint/cc1/domain.rb', line 5681

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

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



5687
5688
5689
5690
5691
# File 'lib/adlint/cc1/domain.rb', line 5687

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

#_intersection_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



6177
6178
6179
6180
6181
6182
6183
# File 'lib/adlint/cc1/domain.rb', line 6177

def _intersection_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes CompositeValueDomain#intersection which
  #       should be overriden by IntersectionValueDomain and
  #       UnionValueDomain.
  rhs_dom.intersection(lhs_dom)
end

#_intersection_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



6193
6194
6195
6196
6197
6198
6199
# File 'lib/adlint/cc1/domain.rb', line 6193

def _intersection_greater_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes CompositeValueDomain#intersection which
  #       should be overriden by IntersectionValueDomain and
  #       UnionValueDomain.
  rhs_dom.intersection(lhs_dom)
end

#_intersection_less_than(lhs_dom, rhs_dom = self) ⇒ Object



6185
6186
6187
6188
6189
6190
6191
# File 'lib/adlint/cc1/domain.rb', line 6185

def _intersection_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes CompositeValueDomain#intersection which
  #       should be overriden by IntersectionValueDomain and
  #       UnionValueDomain.
  rhs_dom.intersection(lhs_dom)
end

#_intersection_nil(lhs_dom, rhs_dom = self) ⇒ Object



6161
6162
6163
6164
6165
6166
6167
# File 'lib/adlint/cc1/domain.rb', line 6161

def _intersection_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes CompositeValueDomain#intersection which
  #       should be overriden by IntersectionValueDomain and
  #       UnionValueDomain.
  rhs_dom.intersection(lhs_dom)
end

#_intersection_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



6169
6170
6171
6172
6173
6174
6175
# File 'lib/adlint/cc1/domain.rb', line 6169

def _intersection_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes CompositeValueDomain#intersection which
  #       should be overriden by IntersectionValueDomain and
  #       UnionValueDomain.
  rhs_dom.intersection(lhs_dom)
end

#_less_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



6041
6042
6043
# File 'lib/adlint/cc1/domain.rb', line 6041

def _less_equal_to(lhs_dom, rhs_dom = self)
  _less(lhs_dom, rhs_dom)
end

#_less_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



6049
6050
6051
# File 'lib/adlint/cc1/domain.rb', line 6049

def _less_greater_than(lhs_dom, rhs_dom = self)
  _less(lhs_dom, rhs_dom)
end

#_less_less_than(lhs_dom, rhs_dom = self) ⇒ Object



6045
6046
6047
# File 'lib/adlint/cc1/domain.rb', line 6045

def _less_less_than(lhs_dom, rhs_dom = self)
  _less(lhs_dom, rhs_dom)
end

#_less_nil(lhs_dom, rhs_dom = self) ⇒ Object



6033
6034
6035
# File 'lib/adlint/cc1/domain.rb', line 6033

def _less_nil(lhs_dom, rhs_dom = self)
  _less(lhs_dom, rhs_dom)
end

#_less_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



6037
6038
6039
# File 'lib/adlint/cc1/domain.rb', line 6037

def _less_unlimited(lhs_dom, rhs_dom = self)
  _less(lhs_dom, rhs_dom)
end

#_logical_and_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



6113
6114
6115
6116
6117
# File 'lib/adlint/cc1/domain.rb', line 6113

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

#_logical_and_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



6125
6126
6127
6128
6129
# File 'lib/adlint/cc1/domain.rb', line 6125

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

#_logical_and_less_than(lhs_dom, rhs_dom = self) ⇒ Object



6119
6120
6121
6122
6123
# File 'lib/adlint/cc1/domain.rb', line 6119

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

#_logical_and_nil(lhs_dom, rhs_dom = self) ⇒ Object



6101
6102
6103
6104
6105
# File 'lib/adlint/cc1/domain.rb', line 6101

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

#_logical_and_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



6107
6108
6109
6110
6111
# File 'lib/adlint/cc1/domain.rb', line 6107

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

#_logical_or_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



6143
6144
6145
6146
6147
# File 'lib/adlint/cc1/domain.rb', line 6143

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

#_logical_or_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



6155
6156
6157
6158
6159
# File 'lib/adlint/cc1/domain.rb', line 6155

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

#_logical_or_less_than(lhs_dom, rhs_dom = self) ⇒ Object



6149
6150
6151
6152
6153
# File 'lib/adlint/cc1/domain.rb', line 6149

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

#_logical_or_nil(lhs_dom, rhs_dom = self) ⇒ Object



6131
6132
6133
6134
6135
# File 'lib/adlint/cc1/domain.rb', line 6131

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

#_logical_or_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



6137
6138
6139
6140
6141
# File 'lib/adlint/cc1/domain.rb', line 6137

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

#_narrow_by_eq(rhs_dom, lhs_dom = self) ⇒ Object



5711
5712
5713
# File 'lib/adlint/cc1/domain.rb', line 5711

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

#_narrow_by_gt(rhs_dom, lhs_dom = self) ⇒ Object



5809
5810
5811
5812
# File 'lib/adlint/cc1/domain.rb', line 5809

def _narrow_by_gt(rhs_dom, lhs_dom = self)
  lhs_dom.intersection(
    ValueDomain.of_unlimited(logical_shr?).narrow(Operator::GT, rhs_dom))
end

#_narrow_by_lt(rhs_dom, lhs_dom = self) ⇒ Object



5765
5766
5767
5768
# File 'lib/adlint/cc1/domain.rb', line 5765

def _narrow_by_lt(rhs_dom, lhs_dom = self)
  lhs_dom.intersection(
    ValueDomain.of_unlimited(logical_shr?).narrow(Operator::LT, rhs_dom))
end

#_narrow_by_ne(rhs_dom, lhs_dom = self) ⇒ Object



5738
5739
5740
# File 'lib/adlint/cc1/domain.rb', line 5738

def _narrow_by_ne(rhs_dom, lhs_dom = self)
  lhs_dom.intersection(rhs_dom.inversion)
end

#_narrow_equal_to_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



5726
5727
5728
# File 'lib/adlint/cc1/domain.rb', line 5726

def _narrow_equal_to_by_eq(lhs_dom, rhs_dom = self)
  lhs_dom.intersection(rhs_dom)
end

#_narrow_equal_to_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



5829
5830
5831
5832
5833
5834
5835
# File 'lib/adlint/cc1/domain.rb', line 5829

def _narrow_equal_to_by_gt(lhs_dom, rhs_dom = self)
  if rhs_min = rhs_dom.min_value and lhs_dom.value < rhs_min
    ValueDomain.of_nil(logical_shr?)
  else
    lhs_dom
  end
end

#_narrow_equal_to_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



5785
5786
5787
5788
5789
5790
5791
# File 'lib/adlint/cc1/domain.rb', line 5785

def _narrow_equal_to_by_lt(lhs_dom, rhs_dom = self)
  if rhs_max = rhs_dom.max_value and lhs_dom.value > rhs_max
    ValueDomain.of_nil(logical_shr?)
  else
    lhs_dom
  end
end

#_narrow_equal_to_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



5753
5754
5755
# File 'lib/adlint/cc1/domain.rb', line 5753

def _narrow_equal_to_by_ne(lhs_dom, rhs_dom = self)
  lhs_dom.intersection(rhs_dom.inversion)
end

#_narrow_greater_than_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



5734
5735
5736
# File 'lib/adlint/cc1/domain.rb', line 5734

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

#_narrow_greater_than_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



5845
5846
5847
5848
5849
5850
5851
# File 'lib/adlint/cc1/domain.rb', line 5845

def _narrow_greater_than_by_gt(lhs_dom, rhs_dom = self)
  if rhs_min = rhs_dom.min_value and lhs_dom.min_value < rhs_min
    ValueDomain.greater_than(rhs_min, logical_shr?)
  else
    lhs_dom
  end
end

#_narrow_greater_than_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



5801
5802
5803
5804
5805
5806
5807
# File 'lib/adlint/cc1/domain.rb', line 5801

def _narrow_greater_than_by_lt(lhs_dom, rhs_dom = self)
  if rhs_max = rhs_dom.max_value and lhs_dom.min_value > rhs_max
    ValueDomain.of_nil(logical_shr?)
  else
    lhs_dom
  end
end

#_narrow_greater_than_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



5761
5762
5763
# File 'lib/adlint/cc1/domain.rb', line 5761

def _narrow_greater_than_by_ne(lhs_dom, rhs_dom = self)
  lhs_dom.intersection(rhs_dom.inversion)
end

#_narrow_less_than_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



5730
5731
5732
# File 'lib/adlint/cc1/domain.rb', line 5730

def _narrow_less_than_by_eq(lhs_dom, rhs_dom = self)
  lhs_dom.intersection(rhs_dom)
end

#_narrow_less_than_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



5837
5838
5839
5840
5841
5842
5843
# File 'lib/adlint/cc1/domain.rb', line 5837

def _narrow_less_than_by_gt(lhs_dom, rhs_dom = self)
  if rhs_min = rhs_dom.min_value and lhs_dom.max_value < rhs_min
    ValueDomain.of_nil(logical_shr?)
  else
    lhs_dom
  end
end

#_narrow_less_than_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



5793
5794
5795
5796
5797
5798
5799
# File 'lib/adlint/cc1/domain.rb', line 5793

def _narrow_less_than_by_lt(lhs_dom, rhs_dom = self)
  if rhs_max = rhs_dom.max_value and lhs_dom.max_value > rhs_max
    ValueDomain.less_than(rhs_max, logical_shr?)
  else
    lhs_dom
  end
end

#_narrow_less_than_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



5757
5758
5759
# File 'lib/adlint/cc1/domain.rb', line 5757

def _narrow_less_than_by_ne(lhs_dom, rhs_dom = self)
  lhs_dom.intersection(rhs_dom.inversion)
end

#_narrow_nil_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



5715
5716
5717
5718
5719
5720
# File 'lib/adlint/cc1/domain.rb', line 5715

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



5814
5815
5816
5817
5818
5819
# File 'lib/adlint/cc1/domain.rb', line 5814

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



5770
5771
5772
5773
5774
5775
# File 'lib/adlint/cc1/domain.rb', line 5770

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



5742
5743
5744
5745
5746
5747
# File 'lib/adlint/cc1/domain.rb', line 5742

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



5722
5723
5724
# File 'lib/adlint/cc1/domain.rb', line 5722

def _narrow_unlimited_by_eq(lhs_dom, rhs_dom = self)
  rhs_dom
end

#_narrow_unlimited_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



5821
5822
5823
5824
5825
5826
5827
# File 'lib/adlint/cc1/domain.rb', line 5821

def _narrow_unlimited_by_gt(lhs_dom, rhs_dom = self)
  if rhs_min = rhs_dom.min_value
    ValueDomain.greater_than(rhs_min, logical_shr?)
  else
    lhs_dom
  end
end

#_narrow_unlimited_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



5777
5778
5779
5780
5781
5782
5783
# File 'lib/adlint/cc1/domain.rb', line 5777

def _narrow_unlimited_by_lt(lhs_dom, rhs_dom = self)
  if rhs_max = rhs_dom.max_value
    ValueDomain.less_than(rhs_max, logical_shr?)
  else
    lhs_dom
  end
end

#_narrow_unlimited_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



5749
5750
5751
# File 'lib/adlint/cc1/domain.rb', line 5749

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

#_not_equal_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



6089
6090
6091
# File 'lib/adlint/cc1/domain.rb', line 6089

def _not_equal_equal_to(lhs_dom, rhs_dom = self)
  _not_equal(lhs_dom, rhs_dom)
end

#_not_equal_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



6097
6098
6099
# File 'lib/adlint/cc1/domain.rb', line 6097

def _not_equal_greater_than(lhs_dom, rhs_dom = self)
  _not_equal(lhs_dom, rhs_dom)
end

#_not_equal_less_than(lhs_dom, rhs_dom = self) ⇒ Object



6093
6094
6095
# File 'lib/adlint/cc1/domain.rb', line 6093

def _not_equal_less_than(lhs_dom, rhs_dom = self)
  _not_equal(lhs_dom, rhs_dom)
end

#_not_equal_nil(lhs_dom, rhs_dom = self) ⇒ Object



6081
6082
6083
# File 'lib/adlint/cc1/domain.rb', line 6081

def _not_equal_nil(lhs_dom, rhs_dom = self)
  _not_equal(lhs_dom, rhs_dom)
end

#_not_equal_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



6085
6086
6087
# File 'lib/adlint/cc1/domain.rb', line 6085

def _not_equal_unlimited(lhs_dom, rhs_dom = self)
  _not_equal(lhs_dom, rhs_dom)
end

#_or_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5945
5946
5947
5948
5949
# File 'lib/adlint/cc1/domain.rb', line 5945

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

#_or_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5957
5958
5959
5960
5961
# File 'lib/adlint/cc1/domain.rb', line 5957

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

#_or_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5951
5952
5953
5954
5955
# File 'lib/adlint/cc1/domain.rb', line 5951

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

#_or_nil(lhs_dom, rhs_dom = self) ⇒ Object



5933
5934
5935
5936
5937
# File 'lib/adlint/cc1/domain.rb', line 5933

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

#_or_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5939
5940
5941
5942
5943
# File 'lib/adlint/cc1/domain.rb', line 5939

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

#_shl_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



6001
6002
6003
# File 'lib/adlint/cc1/domain.rb', line 6001

def _shl_equal_to(lhs_dom, rhs_dom = self)
  _shl(lhs_dom, rhs_dom)
end

#_shl_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



6009
6010
6011
# File 'lib/adlint/cc1/domain.rb', line 6009

def _shl_greater_than(lhs_dom, rhs_dom = self)
  _shl(lhs_dom, rhs_dom)
end

#_shl_less_than(lhs_dom, rhs_dom = self) ⇒ Object



6005
6006
6007
# File 'lib/adlint/cc1/domain.rb', line 6005

def _shl_less_than(lhs_dom, rhs_dom = self)
  _shl(lhs_dom, rhs_dom)
end

#_shl_nil(lhs_dom, rhs_dom = self) ⇒ Object



5993
5994
5995
# File 'lib/adlint/cc1/domain.rb', line 5993

def _shl_nil(lhs_dom, rhs_dom = self)
  _shl(lhs_dom, rhs_dom)
end

#_shl_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5997
5998
5999
# File 'lib/adlint/cc1/domain.rb', line 5997

def _shl_unlimited(lhs_dom, rhs_dom = self)
  _shl(lhs_dom, rhs_dom)
end

#_shr_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



6021
6022
6023
# File 'lib/adlint/cc1/domain.rb', line 6021

def _shr_equal_to(lhs_dom, rhs_dom = self)
  _shr(lhs_dom, rhs_dom)
end

#_shr_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



6029
6030
6031
# File 'lib/adlint/cc1/domain.rb', line 6029

def _shr_greater_than(lhs_dom, rhs_dom = self)
  _shr(lhs_dom, rhs_dom)
end

#_shr_less_than(lhs_dom, rhs_dom = self) ⇒ Object



6025
6026
6027
# File 'lib/adlint/cc1/domain.rb', line 6025

def _shr_less_than(lhs_dom, rhs_dom = self)
  _shr(lhs_dom, rhs_dom)
end

#_shr_nil(lhs_dom, rhs_dom = self) ⇒ Object



6013
6014
6015
# File 'lib/adlint/cc1/domain.rb', line 6013

def _shr_nil(lhs_dom, rhs_dom = self)
  _shr(lhs_dom, rhs_dom)
end

#_shr_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



6017
6018
6019
# File 'lib/adlint/cc1/domain.rb', line 6017

def _shr_unlimited(lhs_dom, rhs_dom = self)
  _shr(lhs_dom, rhs_dom)
end

#_union_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



6215
6216
6217
6218
6219
6220
# File 'lib/adlint/cc1/domain.rb', line 6215

def _union_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes CompositeValueDomain#union which should be
  #       overriden by IntersectionValueDomain and UnionValueDomain.
  rhs_dom.union(lhs_dom)
end

#_union_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



6229
6230
6231
6232
6233
6234
# File 'lib/adlint/cc1/domain.rb', line 6229

def _union_greater_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes CompositeValueDomain#union which should be
  #       overriden by IntersectionValueDomain and UnionValueDomain.
  rhs_dom.union(lhs_dom)
end

#_union_less_than(lhs_dom, rhs_dom = self) ⇒ Object



6222
6223
6224
6225
6226
6227
# File 'lib/adlint/cc1/domain.rb', line 6222

def _union_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes CompositeValueDomain#union which should be
  #       overriden by IntersectionValueDomain and UnionValueDomain.
  rhs_dom.union(lhs_dom)
end

#_union_nil(lhs_dom, rhs_dom = self) ⇒ Object



6201
6202
6203
6204
6205
6206
# File 'lib/adlint/cc1/domain.rb', line 6201

def _union_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes CompositeValueDomain#union which should be
  #       overriden by IntersectionValueDomain and UnionValueDomain.
  rhs_dom.union(lhs_dom)
end

#_union_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



6208
6209
6210
6211
6212
6213
# File 'lib/adlint/cc1/domain.rb', line 6208

def _union_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes CompositeValueDomain#union which should be
  #       overriden by IntersectionValueDomain and UnionValueDomain.
  rhs_dom.union(lhs_dom)
end

#_xor_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



5975
5976
5977
5978
5979
# File 'lib/adlint/cc1/domain.rb', line 5975

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

#_xor_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



5987
5988
5989
5990
5991
# File 'lib/adlint/cc1/domain.rb', line 5987

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

#_xor_less_than(lhs_dom, rhs_dom = self) ⇒ Object



5981
5982
5983
5984
5985
# File 'lib/adlint/cc1/domain.rb', line 5981

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

#_xor_nil(lhs_dom, rhs_dom = self) ⇒ Object



5963
5964
5965
5966
5967
# File 'lib/adlint/cc1/domain.rb', line 5963

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

#_xor_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



5969
5970
5971
5972
5973
# File 'lib/adlint/cc1/domain.rb', line 5969

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

#ambiguous?Boolean



5677
5678
5679
# File 'lib/adlint/cc1/domain.rb', line 5677

def ambiguous?
  false
end

#complexityObject



6240
6241
6242
# File 'lib/adlint/cc1/domain.rb', line 6240

def complexity
  domain_pair.map { |dom| dom.complexity + 1 }.max
end

#empty?Boolean



5665
5666
5667
# File 'lib/adlint/cc1/domain.rb', line 5665

def empty?
  false
end

#nan?Boolean



5669
5670
5671
# File 'lib/adlint/cc1/domain.rb', line 5669

def nan?
  false
end

#to_defined_domainObject



6236
6237
6238
# File 'lib/adlint/cc1/domain.rb', line 6236

def to_defined_domain
  self
end

#undefined?Boolean



5673
5674
5675
# File 'lib/adlint/cc1/domain.rb', line 5673

def undefined?
  false
end