def seek!(seg)
name = (seg.is_a? EDI::Segment) ? seg.name : seg
begin
node = self.node
if name === node.name
@coord.inst_cnt += 1
msg = "Segment #{name} at #{@coord.to_s}: More than #{node.maxrep}!"
if @coord.inst_cnt > node.maxrep
raise EDI::EDILookupError, msg
else
@down_flag = true if node.is_a? TNode
return self
end
end
if node.required? and @coord.inst_cnt == 0
msg = "Missing required segment #{node.name} at #{@coord.to_s}\n" + \
" while looking for segment #{name}!"
raise EDI::EDILookupError, msg
end
end while self.next!
raise "End of diagram exceeded!"
end