Class: MiniKraken::Core::Bookmark

Inherits:
Object
  • Object
show all
Defined in:
lib/mini_kraken/core/bookmark.rb

Overview

A bookmark is a placeholder for events of significance for manipulating the move queue of a blackboard. The events that involve bookmarks are:

  • enter_scope (when executing fresh expression)

  • leave_scope (when all solutions for given scope were found)

  • add_bt_point (when a backtrack point must be added)

  • remove_bt_point (when a backtrack point must be retracted)

  • next_alternative (when an alternative solution is searched)

  • fail! (when the current solution fails)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aKind, aSerialNumber) ⇒ Bookmark

Returns a new instance of Bookmark.

Parameters:

  • aKind (Symbol)

    must be one of: :scope, :bt_point

  • aSerialNumber (Integer)

    a serial number



23
24
25
26
# File 'lib/mini_kraken/core/bookmark.rb', line 23

def initialize(aKind, aSerialNumber)
  @kind = validated_kind(aKind)
  @ser_num = aSerialNumber
end

Instance Attribute Details

#kindSymbol (readonly)

Returns One of: :scope, :bt_point.

Returns:

  • (Symbol)

    One of: :scope, :bt_point



16
17
18
# File 'lib/mini_kraken/core/bookmark.rb', line 16

def kind
  @kind
end

#ser_numInteger (readonly)

Returns An unique serial number.

Returns:

  • (Integer)

    An unique serial number.



19
20
21
# File 'lib/mini_kraken/core/bookmark.rb', line 19

def ser_num
  @ser_num
end

Instance Method Details

#==(other) ⇒ Object

Equality comparison return [Boolean]

Parameters:



31
32
33
# File 'lib/mini_kraken/core/bookmark.rb', line 31

def ==(other)
  ser_num == other.ser_num
end