Class: OpenSkill::Models::ThurstoneMostellerPart::TeamRating

Inherits:
Object
  • Object
show all
Defined in:
lib/openskill/models/thurstone_mosteller_part.rb

Overview

Internal class for team ratings

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mu:, sigma_squared:, team:, rank:) ⇒ TeamRating

Returns a new instance of TeamRating.



358
359
360
361
362
363
# File 'lib/openskill/models/thurstone_mosteller_part.rb', line 358

def initialize(mu:, sigma_squared:, team:, rank:)
  @mu = mu.to_f
  @sigma_squared = sigma_squared.to_f
  @team = team
  @rank = rank.to_i
end

Instance Attribute Details

#mu ⇒ Object (readonly)

Returns the value of attribute mu.



356
357
358
# File 'lib/openskill/models/thurstone_mosteller_part.rb', line 356

def mu
  @mu
end

#rank ⇒ Object (readonly)

Returns the value of attribute rank.



356
357
358
# File 'lib/openskill/models/thurstone_mosteller_part.rb', line 356

def rank
  @rank
end

#sigma_squared ⇒ Object (readonly)

Returns the value of attribute sigma_squared.



356
357
358
# File 'lib/openskill/models/thurstone_mosteller_part.rb', line 356

def sigma_squared
  @sigma_squared
end

#team ⇒ Object (readonly)

Returns the value of attribute team.



356
357
358
# File 'lib/openskill/models/thurstone_mosteller_part.rb', line 356

def team
  @team
end

Instance Method Details

#==(other) ⇒ Object



365
366
367
368
369
370
371
372
# File 'lib/openskill/models/thurstone_mosteller_part.rb', line 365

def ==(other)
  return false unless other.is_a?(TeamRating)

  @mu == other.mu &&
    @sigma_squared == other.sigma_squared &&
    @team == other.team &&
    @rank == other.rank
end

#hash ⇒ Object



374
375
376
# File 'lib/openskill/models/thurstone_mosteller_part.rb', line 374

def hash
  [@mu, @sigma_squared, @team, @rank].hash
end

#to_s ⇒ Object



378
379
380
# File 'lib/openskill/models/thurstone_mosteller_part.rb', line 378

def to_s
  "TeamRating(mu=#{@mu}, sigma_squared=#{@sigma_squared}, rank=#{@rank})"
end