Class: AdLint::Cc1::UnionValueDomain
Instance Attribute Summary
#domain_pair
Instance Method Summary
collapse
-
#! ⇒ Object
-
#&(rhs_dom) ⇒ Object
-
#*(rhs_dom) ⇒ Object
-
#+(rhs_dom) ⇒ Object
-
#+@ ⇒ Object
-
#-@ ⇒ Object
-
#/(rhs_dom) ⇒ Object
-
#<(rhs_dom) ⇒ Object
-
#<<(rhs_dom) ⇒ Object
-
#>>(rhs_dom) ⇒ Object
-
#^(rhs_dom) ⇒ Object
-
#_contain_equal_to?(lhs_dom, rhs_dom = self) ⇒ Boolean
-
#_contain_greater_than?(lhs_dom, rhs_dom = self) ⇒ Boolean
-
#_contain_intersection?(lhs_dom, rhs_dom = self) ⇒ Boolean
-
#_contain_less_than?(lhs_dom, rhs_dom = self) ⇒ Boolean
-
#_contain_nil?(lhs_dom, rhs_dom = self) ⇒ Boolean
-
#_contain_union?(lhs_dom, rhs_dom = self) ⇒ Boolean
-
#_contain_unlimited?(lhs_dom, rhs_dom = self) ⇒ Boolean
-
#_mul_equal_to(lhs_dom, rhs_dom = self) ⇒ Object
-
#_mul_greater_than(lhs_dom, rhs_dom = self) ⇒ Object
-
#_mul_less_than(lhs_dom, rhs_dom = self) ⇒ Object
-
#_mul_nil(lhs_dom, rhs_dom = self) ⇒ Object
-
#_mul_unlimited(lhs_dom, rhs_dom = self) ⇒ Object
-
#coerce_to_integer ⇒ Object
-
#coerce_to_real ⇒ Object
-
#contain_value_domain?(rhs_dom) ⇒ Boolean
-
#each_sample ⇒ Object
-
#intersect?(rhs_dom) ⇒ Boolean
-
#intersection(rhs_dom) ⇒ Object
-
#inversion ⇒ Object
-
#logical_and(rhs_dom) ⇒ Object
-
#logical_or(rhs_dom) ⇒ Object
-
#max_value ⇒ Object
-
#min_value ⇒ Object
-
#to_s ⇒ Object
-
#union(rhs_dom) ⇒ Object
-
#|(rhs_dom) ⇒ Object
-
#~ ⇒ Object
#!=, #==, #_add_equal_to, #_add_greater_than, #_add_less_than, #_add_nil, #_add_unlimited, #_and_equal_to, #_and_greater_than, #_and_less_than, #_and_nil, #_and_unlimited, #_div_equal_to, #_div_greater_than, #_div_less_than, #_div_nil, #_div_unlimited, #_equal_equal_to, #_equal_greater_than, #_equal_less_than, #_equal_nil, #_equal_unlimited, #_intersect_equal_to?, #_intersect_greater_than?, #_intersect_less_than?, #_intersect_nil?, #_intersect_unlimited?, #_intersection_equal_to, #_intersection_greater_than, #_intersection_less_than, #_intersection_nil, #_intersection_unlimited, #_less_equal_to, #_less_greater_than, #_less_less_than, #_less_nil, #_less_unlimited, #_logical_and_equal_to, #_logical_and_greater_than, #_logical_and_less_than, #_logical_and_nil, #_logical_and_unlimited, #_logical_or_equal_to, #_logical_or_greater_than, #_logical_or_less_than, #_logical_or_nil, #_logical_or_unlimited, #_narrow_by_eq, #_narrow_by_gt, #_narrow_by_lt, #_narrow_by_ne, #_narrow_equal_to_by_eq, #_narrow_equal_to_by_gt, #_narrow_equal_to_by_lt, #_narrow_equal_to_by_ne, #_narrow_greater_than_by_eq, #_narrow_greater_than_by_gt, #_narrow_greater_than_by_lt, #_narrow_greater_than_by_ne, #_narrow_less_than_by_eq, #_narrow_less_than_by_gt, #_narrow_less_than_by_lt, #_narrow_less_than_by_ne, #_narrow_nil_by_eq, #_narrow_nil_by_gt, #_narrow_nil_by_lt, #_narrow_nil_by_ne, #_narrow_unlimited_by_eq, #_narrow_unlimited_by_gt, #_narrow_unlimited_by_lt, #_narrow_unlimited_by_ne, #_not_equal_equal_to, #_not_equal_greater_than, #_not_equal_less_than, #_not_equal_nil, #_not_equal_unlimited, #_or_equal_to, #_or_greater_than, #_or_less_than, #_or_nil, #_or_unlimited, #_shl_equal_to, #_shl_greater_than, #_shl_less_than, #_shl_nil, #_shl_unlimited, #_shr_equal_to, #_shr_greater_than, #_shr_less_than, #_shr_nil, #_shr_unlimited, #_union_equal_to, #_union_greater_than, #_union_less_than, #_union_nil, #_union_unlimited, #_xor_equal_to, #_xor_greater_than, #_xor_less_than, #_xor_nil, #_xor_unlimited, #ambiguous?, #complexity, #empty?, #initialize, #nan?, #to_defined_domain, #undefined?
Methods inherited from ValueDomain
#!=, #%, #-, #<=, #<=>, #==, #>, #>=, #_add_equal_to, #_add_greater_than, #_add_less_than, #_add_nil, #_add_unlimited, #_and_equal_to, #_and_greater_than, #_and_less_than, #_and_nil, #_and_unlimited, #_div_equal_to, #_div_greater_than, #_div_less_than, #_div_nil, #_div_unlimited, #_equal_equal_to, #_equal_greater_than, #_equal_less_than, #_equal_nil, #_equal_unlimited, #_intersect_equal_to?, #_intersect_greater_than?, #_intersect_less_than?, #_intersect_nil?, #_intersect_unlimited?, #_intersection_equal_to, #_intersection_greater_than, #_intersection_less_than, #_intersection_nil, #_intersection_unlimited, #_less_equal_to, #_less_greater_than, #_less_less_than, #_less_nil, #_less_unlimited, #_logical_and_equal_to, #_logical_and_greater_than, #_logical_and_less_than, #_logical_and_nil, #_logical_and_unlimited, #_logical_or_equal_to, #_logical_or_greater_than, #_logical_or_less_than, #_logical_or_nil, #_logical_or_unlimited, #_narrow_by_eq, #_narrow_by_ge, #_narrow_by_gt, #_narrow_by_le, #_narrow_by_lt, #_narrow_by_ne, #_narrow_equal_to_by_eq, #_narrow_equal_to_by_gt, #_narrow_equal_to_by_lt, #_narrow_equal_to_by_ne, #_narrow_greater_than_by_eq, #_narrow_greater_than_by_gt, #_narrow_greater_than_by_lt, #_narrow_greater_than_by_ne, #_narrow_less_than_by_eq, #_narrow_less_than_by_gt, #_narrow_less_than_by_lt, #_narrow_less_than_by_ne, #_narrow_nil_by_eq, #_narrow_nil_by_gt, #_narrow_nil_by_lt, #_narrow_nil_by_ne, #_narrow_unlimited_by_eq, #_narrow_unlimited_by_gt, #_narrow_unlimited_by_lt, #_narrow_unlimited_by_ne, #_not_equal_equal_to, #_not_equal_greater_than, #_not_equal_less_than, #_not_equal_nil, #_not_equal_unlimited, #_or_equal_to, #_or_greater_than, #_or_less_than, #_or_nil, #_or_unlimited, #_shl_equal_to, #_shl_greater_than, #_shl_less_than, #_shl_nil, #_shl_unlimited, #_shr_equal_to, #_shr_greater_than, #_shr_less_than, #_shr_nil, #_shr_unlimited, #_union_equal_to, #_union_greater_than, #_union_less_than, #_union_nil, #_union_unlimited, #_widen_by_eq, #_widen_by_ge, #_widen_by_gt, #_widen_by_le, #_widen_by_lt, #_widen_by_ne, #_xor_equal_to, #_xor_greater_than, #_xor_less_than, #_xor_nil, #_xor_unlimited, #ambiguous?, #complexity, #contain?, #empty?, #eql?, #hash, #initialize, #logical_shr?, #nan?, #narrow, #to_defined_domain, #undefined?, #widen
#_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
Instance Method Details
6824
6825
6826
6827
|
# File 'lib/adlint/cc1/domain.rb', line 6824
def !
new_sub_doms = domain_pair.map { |dom| !dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#*(rhs_dom) ⇒ Object
6755
6756
6757
6758
|
# File 'lib/adlint/cc1/domain.rb', line 6755
def *(rhs_dom)
new_sub_doms = domain_pair.map { |lhs| lhs * rhs_dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#+(rhs_dom) ⇒ Object
6750
6751
6752
6753
|
# File 'lib/adlint/cc1/domain.rb', line 6750
def +(rhs_dom)
new_sub_doms = domain_pair.map { |lhs| lhs + rhs_dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
6740
6741
6742
6743
|
# File 'lib/adlint/cc1/domain.rb', line 6740
def +@
new_sub_doms = domain_pair.map { |dom| +dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
6745
6746
6747
6748
|
# File 'lib/adlint/cc1/domain.rb', line 6745
def -@
new_sub_doms = domain_pair.map { |dom| -dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#/(rhs_dom) ⇒ Object
6790
6791
6792
6793
|
# File 'lib/adlint/cc1/domain.rb', line 6790
def /(rhs_dom)
new_sub_doms = domain_pair.map { |lhs| lhs / rhs_dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#<(rhs_dom) ⇒ Object
6829
6830
6831
6832
|
# File 'lib/adlint/cc1/domain.rb', line 6829
def <(rhs_dom)
comp_dom = domain_pair.map { |lhs| lhs < rhs_dom }
comp_dom.first.union(comp_dom.last)
end
|
#<<(rhs_dom) ⇒ Object
6814
6815
6816
6817
|
# File 'lib/adlint/cc1/domain.rb', line 6814
def <<(rhs_dom)
new_sub_doms = domain_pair.map { |lhs| lhs << rhs_dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#>>(rhs_dom) ⇒ Object
6819
6820
6821
6822
|
# File 'lib/adlint/cc1/domain.rb', line 6819
def >>(rhs_dom)
new_sub_doms = domain_pair.map { |lhs| lhs >> rhs_dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#^(rhs_dom) ⇒ Object
6809
6810
6811
6812
|
# File 'lib/adlint/cc1/domain.rb', line 6809
def ^(rhs_dom)
new_sub_doms = domain_pair.map { |lhs| lhs ^ rhs_dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#_contain_equal_to?(lhs_dom, rhs_dom = self) ⇒ Boolean
6687
6688
6689
|
# File 'lib/adlint/cc1/domain.rb', line 6687
def _contain_equal_to?(lhs_dom, rhs_dom = self)
rhs_dom.domain_pair.all? { |rhs| lhs_dom.contain_value_domain?(rhs) }
end
|
#_contain_greater_than?(lhs_dom, rhs_dom = self) ⇒ Boolean
6695
6696
6697
|
# File 'lib/adlint/cc1/domain.rb', line 6695
def _contain_greater_than?(lhs_dom, rhs_dom = self)
rhs_dom.domain_pair.all? { |rhs| lhs_dom.contain_value_domain?(rhs) }
end
|
#_contain_intersection?(lhs_dom, rhs_dom = self) ⇒ Boolean
6699
6700
6701
|
# File 'lib/adlint/cc1/domain.rb', line 6699
def _contain_intersection?(lhs_dom, rhs_dom = self)
rhs_dom.domain_pair.all? { |rhs| lhs_dom.contain_value_domain?(rhs) }
end
|
#_contain_less_than?(lhs_dom, rhs_dom = self) ⇒ Boolean
6691
6692
6693
|
# File 'lib/adlint/cc1/domain.rb', line 6691
def _contain_less_than?(lhs_dom, rhs_dom = self)
rhs_dom.domain_pair.all? { |rhs| lhs_dom.contain_value_domain?(rhs) }
end
|
#_contain_nil?(lhs_dom, rhs_dom = self) ⇒ Boolean
6679
6680
6681
|
# File 'lib/adlint/cc1/domain.rb', line 6679
def _contain_nil?(lhs_dom, rhs_dom = self)
false
end
|
#_contain_union?(lhs_dom, rhs_dom = self) ⇒ Boolean
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
|
# File 'lib/adlint/cc1/domain.rb', line 6703
def _contain_union?(lhs_dom, rhs_dom = self)
lhs_fst, lhs_snd = lhs_dom.domain_pair
rhs_dom_pair = rhs_dom.domain_pair
case
when rhs_dom_pair.all? { |rhs| lhs_fst.contain_value_domain?(rhs) }
true
when rhs_dom_pair.all? { |rhs| lhs_snd.contain_value_domain?(rhs) }
true
else
rhs_fst, rhs_snd = rhs_dom.domain_pair
case
when lhs_fst.contain_value_domain?(rhs_fst) &&
lhs_snd.contain_value_domain?(rhs_snd)
true
when lhs_fst.contain_value_domain?(rhs_snd) &&
lhs_snd.contain_value_domain?(rhs_fst)
true
else
false
end
end
end
|
#_contain_unlimited?(lhs_dom, rhs_dom = self) ⇒ Boolean
6683
6684
6685
|
# File 'lib/adlint/cc1/domain.rb', line 6683
def _contain_unlimited?(lhs_dom, rhs_dom = self)
true
end
|
#_mul_equal_to(lhs_dom, rhs_dom = self) ⇒ Object
6772
6773
6774
6775
6776
|
# File 'lib/adlint/cc1/domain.rb', line 6772
def _mul_equal_to(lhs_dom, rhs_dom = self)
rhs_dom * lhs_dom
end
|
#_mul_greater_than(lhs_dom, rhs_dom = self) ⇒ Object
6784
6785
6786
6787
6788
|
# File 'lib/adlint/cc1/domain.rb', line 6784
def _mul_greater_than(lhs_dom, rhs_dom = self)
rhs_dom * lhs_dom
end
|
#_mul_less_than(lhs_dom, rhs_dom = self) ⇒ Object
6778
6779
6780
6781
6782
|
# File 'lib/adlint/cc1/domain.rb', line 6778
def _mul_less_than(lhs_dom, rhs_dom = self)
rhs_dom * lhs_dom
end
|
#_mul_nil(lhs_dom, rhs_dom = self) ⇒ Object
6760
6761
6762
6763
6764
|
# File 'lib/adlint/cc1/domain.rb', line 6760
def _mul_nil(lhs_dom, rhs_dom = self)
rhs_dom * lhs_dom
end
|
#_mul_unlimited(lhs_dom, rhs_dom = self) ⇒ Object
6766
6767
6768
6769
6770
|
# File 'lib/adlint/cc1/domain.rb', line 6766
def _mul_unlimited(lhs_dom, rhs_dom = self)
rhs_dom * lhs_dom
end
|
#coerce_to_integer ⇒ Object
6868
6869
6870
6871
|
# File 'lib/adlint/cc1/domain.rb', line 6868
def coerce_to_integer
new_sub_doms = domain_pair.map { |dom| dom.coerce_to_integer }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#coerce_to_real ⇒ Object
6873
6874
6875
6876
|
# File 'lib/adlint/cc1/domain.rb', line 6873
def coerce_to_real
new_sub_doms = domain_pair.map { |dom| dom.coerce_to_real }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#contain_value_domain?(rhs_dom) ⇒ Boolean
6675
6676
6677
|
# File 'lib/adlint/cc1/domain.rb', line 6675
def contain_value_domain?(rhs_dom)
rhs_dom._contain_union?(self)
end
|
#each_sample ⇒ Object
6905
6906
6907
6908
6909
6910
|
# File 'lib/adlint/cc1/domain.rb', line 6905
def each_sample
return to_enum(:each_sample) unless block_given?
domain_pair.map { |d| d.each_sample.to_a }.flatten.uniq.each do |sample|
yield(sample)
end
end
|
#intersect?(rhs_dom) ⇒ Boolean
6726
6727
6728
|
# File 'lib/adlint/cc1/domain.rb', line 6726
def intersect?(rhs_dom)
domain_pair.any? { |lhs| lhs.intersect?(rhs_dom) }
end
|
#intersection(rhs_dom) ⇒ Object
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
|
# File 'lib/adlint/cc1/domain.rb', line 6844
def intersection(rhs_dom)
case
when contain_value_domain?(rhs_dom)
rhs_dom
when rhs_dom.contain_value_domain?(self)
self
else
new_sub_doms = domain_pair.map { |lhs| lhs.intersection(rhs_dom) }
ValueDomain.of_union(*new_sub_doms)
end
end
|
#inversion ⇒ Object
6730
6731
6732
6733
|
# File 'lib/adlint/cc1/domain.rb', line 6730
def inversion
new_sub_doms = domain_pair.map { |dom| dom.inversion }
new_sub_doms.first.intersection(new_sub_doms.last)
end
|
#logical_and(rhs_dom) ⇒ Object
6834
6835
6836
6837
|
# File 'lib/adlint/cc1/domain.rb', line 6834
def logical_and(rhs_dom)
new_sub_doms = domain_pair.map { |lhs| lhs.logical_and(rhs_dom) }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#logical_or(rhs_dom) ⇒ Object
6839
6840
6841
6842
|
# File 'lib/adlint/cc1/domain.rb', line 6839
def logical_or(rhs_dom)
new_sub_doms = domain_pair.map { |lhs| lhs.logical_or(rhs_dom) }
new_sub_doms.first.union(new_sub_doms.last)
end
|
#max_value ⇒ Object
6896
6897
6898
6899
6900
6901
6902
|
# File 'lib/adlint/cc1/domain.rb', line 6896
def max_value
max_vals = domain_pair.map { |dom| dom.max_value }
max_vals.include?(nil) ? nil : max_vals.max
end
|
#min_value ⇒ Object
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
|
# File 'lib/adlint/cc1/domain.rb', line 6878
def min_value
min_vals = domain_pair.map { |dom| dom.min_value }
min_vals.include?(nil) ? nil : min_vals.min
end
|
6912
6913
6914
|
# File 'lib/adlint/cc1/domain.rb', line 6912
def to_s
"(#{domain_pair.first.to_s} || #{domain_pair.last.to_s})"
end
|
#union(rhs_dom) ⇒ Object
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
|
# File 'lib/adlint/cc1/domain.rb', line 6856
def union(rhs_dom)
case
when contain_value_domain?(rhs_dom)
self
when rhs_dom.contain_value_domain?(self)
rhs_dom
else
new_sub_doms = domain_pair.map { |lhs| lhs.union(rhs_dom) }
ValueDomain.of_union(*new_sub_doms)
end
end
|
#|(rhs_dom) ⇒ Object
6804
6805
6806
6807
|
# File 'lib/adlint/cc1/domain.rb', line 6804
def |(rhs_dom)
new_sub_doms = domain_pair.map { |lhs| lhs | rhs_dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|
6735
6736
6737
6738
|
# File 'lib/adlint/cc1/domain.rb', line 6735
def ~
new_sub_doms = domain_pair.map { |dom| ~dom }
new_sub_doms.first.union(new_sub_doms.last)
end
|