Class: AbstInt
- Inherits:
-
Object
show all
- Defined in:
- lib/abst_int.rb,
lib/abst_int/version.rb
Defined Under Namespace
Modules: CalculusModel
Classes: Collection, Integer, MultiResultError, OrSet, Set, Term, Variable
Constant Summary
collapse
- VERSION =
"0.0.3"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(terms = AbstInt::OrSet.new(1, true)) ⇒ AbstInt
Returns a new instance of AbstInt.
12
13
14
|
# File 'lib/abst_int.rb', line 12
def initialize terms = AbstInt::OrSet.new(1, true)
@terms = terms
end
|
Instance Attribute Details
Returns the value of attribute terms.
10
11
12
|
# File 'lib/abst_int.rb', line 10
def terms
@terms
end
|
Instance Method Details
35
36
37
|
# File 'lib/abst_int.rb', line 35
def % num
return self.terms % num
end
|
#&(abst_int_or_int) ⇒ Object
44
45
46
47
|
# File 'lib/abst_int.rb', line 44
def & abst_int_or_int
terms = to_set abst_int_or_int
return AbstInt.new(self.terms & terms)
end
|
#*(abst_int_or_int) ⇒ Object
26
27
28
29
|
# File 'lib/abst_int.rb', line 26
def * abst_int_or_int
terms = to_set abst_int_or_int
return AbstInt.new(self.terms * terms)
end
|
#+(abst_int_or_int) ⇒ Object
16
17
18
19
|
# File 'lib/abst_int.rb', line 16
def + abst_int_or_int
terms = to_set abst_int_or_int
return AbstInt.new(self.terms + terms)
end
|
#-(abst_int_or_int) ⇒ Object
21
22
23
24
|
# File 'lib/abst_int.rb', line 21
def - abst_int_or_int
terms = to_set abst_int_or_int
return AbstInt.new(self.terms - terms)
end
|
#/(abst_int_or_int) ⇒ Object
31
32
33
|
# File 'lib/abst_int.rb', line 31
def / abst_int_or_int
raise "not implement"
end
|
49
50
51
|
# File 'lib/abst_int.rb', line 49
def not
return AbstInt.new(self.terms.not)
end
|
53
54
55
|
# File 'lib/abst_int.rb', line 53
def to_s
@terms.to_s
end
|
#|(abst_int_or_int) ⇒ Object
39
40
41
42
|
# File 'lib/abst_int.rb', line 39
def | abst_int_or_int
terms = to_set abst_int_or_int
return AbstInt.new(self.terms | terms)
end
|