2012-11-21 18:10:50 -05:00
|
|
|
module Mutant
|
|
|
|
class Strategy
|
2012-11-26 05:30:00 -05:00
|
|
|
include AbstractType
|
2012-11-21 18:10:50 -05:00
|
|
|
|
|
|
|
# Kill mutation
|
|
|
|
#
|
|
|
|
# @param [Mutation]
|
|
|
|
#
|
|
|
|
# @return [Killer]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def self.kill(mutation)
|
|
|
|
killer.new(self, mutation)
|
|
|
|
end
|
|
|
|
|
2012-12-07 10:55:53 -05:00
|
|
|
# Return killer
|
|
|
|
#
|
|
|
|
# @return [Class:Killer]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2012-11-21 18:10:50 -05:00
|
|
|
def self.killer
|
2012-11-21 20:08:42 -05:00
|
|
|
self::KILLER
|
2012-11-21 18:10:50 -05:00
|
|
|
end
|
|
|
|
|
2012-12-07 10:55:53 -05:00
|
|
|
# Static strategies
|
2012-11-21 21:00:36 -05:00
|
|
|
class Static < self
|
2012-12-07 10:55:53 -05:00
|
|
|
|
|
|
|
# Always fail to kill strategy
|
2012-11-21 21:00:36 -05:00
|
|
|
class Fail < self
|
|
|
|
KILLER = Killer::Static::Fail
|
|
|
|
end
|
|
|
|
|
2012-12-07 10:55:53 -05:00
|
|
|
# Always succeed to kill strategy
|
2012-11-21 21:00:36 -05:00
|
|
|
class Success < self
|
|
|
|
KILLER = Killer::Static::Success
|
|
|
|
end
|
2012-11-21 18:10:50 -05:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|