Class: Abst::IntegerIdeal

Inherits:
Object
  • Object
show all
Defined in:
lib/include/integer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(n) ⇒ IntegerIdeal

Returns a new instance of IntegerIdeal.



260
261
262
# File 'lib/include/integer.rb', line 260

def initialize(n)
	@n = n
end

Instance Attribute Details

#nObject (readonly)

Returns the value of attribute n.



258
259
260
# File 'lib/include/integer.rb', line 258

def n
  @n
end

Instance Method Details

#&(other) ⇒ Object



272
273
274
# File 'lib/include/integer.rb', line 272

def &(other)
	self.class.new(Abst.lcm(@mod, other.mod))
end

#*(other) ⇒ Object



268
269
270
# File 'lib/include/integer.rb', line 268

def *(other)
	self.class.new(@mod * other.mod)
end

#+(other) ⇒ Object



264
265
266
# File 'lib/include/integer.rb', line 264

def +(other)
	self.class.new(Abst.gcd(@mod, other.mod))
end

#to_sObject Also known as: inspect



276
277
278
# File 'lib/include/integer.rb', line 276

def to_s
	return "IntegerIdeal #{@n}Z"
end

#to_texObject



281
282
283
# File 'lib/include/integer.rb', line 281

def to_tex
	return "#{@n}#{Z.to_tex}"
end