class Evoc::InterestingnessMeasure
Attributes
hyper_measure[RW]
max[RW]
mid[RW]
min[RW]
type[RW]
value[RW]
Public Class Methods
new(type:,min:,mid:,max:,value: nil,hyper_measure: false) { || ... }
click to toggle source
# File lib/evoc/interestingness_measure.rb, line 6 def initialize(type:,min:,mid:,max:,value: nil,hyper_measure: false) @type = type self.min = min self.max = max self.mid = mid self.hyper_measure = hyper_measure if block_given? self.value = yield else self.value = value end end
Public Instance Methods
-@()
click to toggle source
# File lib/evoc/interestingness_measure.rb, line 56 def -@ -self.value end
<=>(other)
click to toggle source
# File lib/evoc/interestingness_measure.rb, line 51 def <=> other return nil unless constr_equal_type other self.value <=> other.value end
finite?()
click to toggle source
# File lib/evoc/interestingness_measure.rb, line 60 def finite? self.value.finite? end
max=(m)
click to toggle source
# File lib/evoc/interestingness_measure.rb, line 27 def max=m @max = m end
mid=(m)
click to toggle source
# File lib/evoc/interestingness_measure.rb, line 31 def mid=m @mid = m end
min=(m)
click to toggle source
def value
@value.nil? ? @value : @value
end
# File lib/evoc/interestingness_measure.rb, line 23 def min=m @min = m end
to_s()
click to toggle source
# File lib/evoc/interestingness_measure.rb, line 64 def to_s self.value.to_s end
value=(v)
click to toggle source
# File lib/evoc/interestingness_measure.rb, line 35 def value=v if v.nil? @value = nil elsif v.to_f.nan? logger.warn "#{self.type}: #{v} was NAN" @value = nil else @value = v if !self.hyper_measure if !v.between?(self.min,self.max) logger.warn "#{self.type}: #{v} is not in the domain of [#{self.min},#{self.max}]" end end end end
Private Instance Methods
constr_equal_type(other)
click to toggle source
# File lib/evoc/interestingness_measure.rb, line 69 def constr_equal_type other (self.class == other.class ? true : ( raise ArgumentError, "self: #{self.type}: #{self.class} was of different class than other: #{other.class}" ) ) & (self.max == other.max ? true : ( raise ArgumentError, "self: #{self.type}: #{self.max} had a different max than other: #{other.max}" ) ) & (self.mid == other.mid ? true : ( raise ArgumentError, "self: #{self.type}: #{self.mid} had a different mid than other: #{other.mid}" ) ) & (self.min == other.min ? true : ( raise ArgumentError, "self: #{self.type}: #{self.min} had a different min than other: #{other.min}" ) ) & (self.type == other.type ? true : ( raise ArgumentError, "self: #{self.type}: #{self.type}had a different type than other: #{other.type}" ) ) end