Class: Fastcluster::Cluster
- Inherits:
-
Object
- Object
- Fastcluster::Cluster
- Includes:
- Comparable
- Defined in:
- lib/fastcluster/cluster.rb
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #<=>(anOther) ⇒ Object
-
#initialize(x, y, size) ⇒ Cluster
constructor
A new instance of Cluster.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(x, y, size) ⇒ Cluster
Returns a new instance of Cluster.
7 8 9 10 11 |
# File 'lib/fastcluster/cluster.rb', line 7 def initialize(x, y, size) @x = x @y = y @size = size end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
5 6 7 |
# File 'lib/fastcluster/cluster.rb', line 5 def size @size end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
5 6 7 |
# File 'lib/fastcluster/cluster.rb', line 5 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
5 6 7 |
# File 'lib/fastcluster/cluster.rb', line 5 def y @y end |
Instance Method Details
#<=>(anOther) ⇒ Object
13 14 15 |
# File 'lib/fastcluster/cluster.rb', line 13 def <=>(anOther) size <=> anOther.size end |
#inspect ⇒ Object
17 18 19 |
# File 'lib/fastcluster/cluster.rb', line 17 def inspect to_s end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/fastcluster/cluster.rb', line 21 def to_s '(%0.2f, %0.2f): %d' % [@x, @y, @size] end |