Class: Hashira::Duplication::Cluster
- Inherits:
-
Data
- Object
- Data
- Hashira::Duplication::Cluster
- Defined in:
- lib/hashira/duplication/cluster.rb
Instance Attribute Summary collapse
-
#sites ⇒ Object
readonly
Returns the value of attribute sites.
Instance Method Summary collapse
- #canonical ⇒ Object
- #exact_sites ⇒ Object
- #mass ⇒ Object
- #others ⇒ Object
- #shape_count(site) ⇒ Object
- #shape_only? ⇒ Boolean
- #site_masses ⇒ Object
- #size ⇒ Object
Instance Attribute Details
#sites ⇒ Object (readonly)
Returns the value of attribute sites
5 6 7 |
# File 'lib/hashira/duplication/cluster.rb', line 5 def sites @sites end |
Instance Method Details
#canonical ⇒ Object
6 |
# File 'lib/hashira/duplication/cluster.rb', line 6 def canonical = sites.max_by { |site| [shape_count(site), site.mass] } |
#exact_sites ⇒ Object
15 |
# File 'lib/hashira/duplication/cluster.rb', line 15 def exact_sites = sites.select { it.types == canonical.types } |
#mass ⇒ Object
17 |
# File 'lib/hashira/duplication/cluster.rb', line 17 def mass = canonical.mass |
#others ⇒ Object
10 11 12 13 |
# File 'lib/hashira/duplication/cluster.rb', line 10 def others chosen = canonical sites.reject { |site| site.equal?(chosen) } end |
#shape_count(site) ⇒ Object
8 |
# File 'lib/hashira/duplication/cluster.rb', line 8 def shape_count(site) = sites.count { |other| other.types == site.types } |
#shape_only? ⇒ Boolean
23 |
# File 'lib/hashira/duplication/cluster.rb', line 23 def shape_only? = others.all? { Variance.new(canonical, it).shape_only? } |
#site_masses ⇒ Object
21 |
# File 'lib/hashira/duplication/cluster.rb', line 21 def site_masses = sites.map { [it.file, mass] } |
#size ⇒ Object
19 |
# File 'lib/hashira/duplication/cluster.rb', line 19 def size = sites.size |