<<( event )
click to toggle source
def <<( event )
add_event_to_arry( @events, event )
end
expected()
click to toggle source
def expected
return [@events[@current]]
end
inspect()
click to toggle source
def inspect
"< #{to_s} #{@events.collect{|e|
pre = e == @events[@current] ? '#' : ''
pre + e.inspect unless self == e
}.join(', ')} >"
end
next( event )
click to toggle source
def next( event )
return @previous.pop.next( event ) if @events[@current].nil?
expand_ref_in( @events, @current ) if @events[@current].class == Ref
if ( @events[@current].kind_of? State )
@current += 1
@events[@current-1].previous = self
return @events[@current-1].next( event )
end
if ( @events[@current].matches?(event) )
@current += 1
if @events[@current].nil?
return @previous.pop
elsif @events[@current].kind_of? State
@current += 1
@events[@current-1].previous = self
return @events[@current-1]
else
return self
end
else
return nil
end
end
previous=( previous )
click to toggle source
def previous=( previous )
@previous << previous
end
reset()
click to toggle source
def reset
return if @current == 0
@current = 0
@events.each {|s| s.reset if s.kind_of? State }
end
to_s()
click to toggle source
def to_s
self.class.name =~ /(?:::)(\w)\w+$/
"#$1.#@count"
end