Class: Ibex::Runtime::RepairSearchResult

Inherits:
Object
  • Object
show all
Defined in:
lib/ibex/runtime/repair.rb,
sig/ibex/runtime/repair.rbs

Overview

Closed internal outcome for callers that must distinguish bounded search exhaustion from a complete search with no repair.

Constant Summary collapse

STATUSES =

Signature:

  • Array[Symbol]

Returns:

  • (Array[Symbol])
%i[selected need_input exhausted not_found].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, plan:, configurations:) ⇒ RepairSearchResult

Returns a new instance of RepairSearchResult.

RBS:

  • (status: Symbol, plan: RepairPlan?, configurations: Integer) -> void

Parameters:

  • status: (Symbol)
  • plan: (RepairPlan, nil)
  • configurations: (Integer)


105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/ibex/runtime/repair.rb', line 105

def initialize(status:, plan:, configurations:)
  raise ArgumentError, "unknown repair search status #{status.inspect}" unless STATUSES.include?(status)
  unless configurations.is_a?(Integer) && configurations >= 0
    raise ArgumentError, "repair search configurations must be nonnegative"
  end
  unless (status == :selected) == plan.is_a?(RepairPlan)
    raise ArgumentError, "selected repair search status and plan must agree"
  end

  @status = status
  @plan = plan
  @configurations = configurations
  freeze
end

Instance Attribute Details

#configurationsInteger (readonly)

Signature:

  • Integer

Returns:

  • (Integer)


102
103
104
# File 'lib/ibex/runtime/repair.rb', line 102

def configurations
  @configurations
end

#planRepairPlan? (readonly)

Signature:

  • RepairPlan?

Returns:



101
102
103
# File 'lib/ibex/runtime/repair.rb', line 101

def plan
  @plan
end

#statusSymbol (readonly)

Signature:

  • Symbol

Returns:

  • (Symbol)


100
101
102
# File 'lib/ibex/runtime/repair.rb', line 100

def status
  @status
end

Instance Method Details

#selected?Boolean

RBS:

  • () -> bool

Returns:

  • (Boolean)


121
# File 'lib/ibex/runtime/repair.rb', line 121

def selected? = @status == :selected