Class | REXML::Validation::State
In: | rexml/validation/relaxng.rb
Parent: | Object

### Methods

<< expected inspect new next previous= reset to_s

### Public Class methods

new( context )

[Source]

    # File rexml/validation/relaxng.rb, line 127
          def initialize( context )
            @previous = []
            @events = []
            @current = 0
            @count = context.count += 1
            @references = context.references
            @value = false
          end

### Public Instance methods

<<( event )

[Source]

    # File rexml/validation/relaxng.rb, line 196
          def <<( event )
            add_event_to_arry( @events, event )
          end

expected()

[Source]

    # File rexml/validation/relaxng.rb, line 192
          def expected
            return [@events[@current]]
          end

inspect()

[Source]

    # File rexml/validation/relaxng.rb, line 185
          def inspect
            "< #{to_s} #{@events.collect{|e|
              pre = e == @events[@current] ? '#' : ''
              pre + e.inspect unless self == e
            }.join(', ')} >"
          end

next( event )

[Source]

    # File rexml/validation/relaxng.rb, line 146
          def next( event )
            #print "In next with #{event.inspect}.  "
            #puts "Next (#@current) is #{@events[@current]}"
            #p @previous
            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
            #puts "Current isn't a state"
            if ( @events[@current].matches?(event) )
              @current += 1
              if @events[@current].nil?
                #puts "#{inspect[0,5]} 1RETURNING #{@previous.inspect[0,5]}"
                return @previous.pop
              elsif @events[@current].kind_of? State
                @current += 1
                #puts "#{inspect[0,5]} 2RETURNING (#{@current-1}) #{@events[@current-1].inspect[0,5]}; on return, next is #{@events[@current]}"
                @events[@current-1].previous = self
                return @events[@current-1]
              else
                #puts "#{inspect[0,5]} RETURNING self w/ next(#@current) = #{@events[@current]}"
                return self
              end
            else
              return nil
            end
          end

previous=( previous )

[Source]

    # File rexml/validation/relaxng.rb, line 142
          def previous=( previous )
            @previous << previous
          end

reset()

[Source]

    # File rexml/validation/relaxng.rb, line 136
          def reset
            return if @current == 0
            @current = 0
            @events.each {|s| s.reset if s.kind_of? State }
          end

to_s()

[Source]

    # File rexml/validation/relaxng.rb, line 177
          def to_s
            # Abbreviated:
            self.class.name =~ /(?:::)(\w)\w+$/
            # Full:
            #self.class.name =~ /(?:::)(\w+)$/
            "#$1.#@count"
          end

[Validate]