Class: Racc::ISet

### Home Classes Methods

### In Files

- lib/racc/iset.rb

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #add
- #clear
- #delete
- #dup
- #each
- #empty?
- #include?
- #inspect
- #key?
- #size
- #to_a
- #to_s
- #update
- #update_a

### Files

- Manifest.txt
- README.rdoc
- pre-setup
- NEWS.en.rdoc
- grammar.en.rdoc

### Class/Module Index

Quicksearch

- Racc
- Racc::Accept
- Racc::ActionTable
- Racc::CompileError
- Racc::DebugFlags
- Racc::Error
- Racc::Goto
- Racc::Grammar
- Racc::Grammar::DefinitionEnv
- Racc::Grammar::PrecedenceDefinitionEnv
- Racc::GrammarFileParser
- Racc::GrammarFileParser::Result
- Racc::GrammarFileScanner
- Racc::ISet
- Racc::Item
- Racc::LocationPointer
- Racc::LogFileGenerator
- Racc::OrMark
- Racc::ParseError
- Racc::ParseError
- Racc::Parser
- Racc::ParserClassGenerator
- Racc::ParserFileGenerator
- Racc::ParserFileGenerator::Params
- Racc::Prec
- Racc::RRconflict
- Racc::Reduce
- Racc::Rule
- Racc::SRconflict
- Racc::Shift
- Racc::SourceText
- Racc::State
- Racc::StateTransitionTable
- Racc::StateTransitionTableGenerator
- Racc::States
- Racc::Sym
- Racc::SymbolTable
- Racc::UserAction
- Object
- Object::ParseError
- Array

No matching classes.

# Racc::ISet

An "indexed" set. All items must respond to :ident.

### Attributes

set[R]

### Public Class Methods

new(a = []) click to toggle source

    # File lib/racc/iset.rb, line 17
    def initialize(a = [])
      @set = a
    end

### Public Instance Methods

[](key) click to toggle source

    # File lib/racc/iset.rb, line 27
    def [](key)
      @set[key.ident]
    end

Also aliased as: include?, key?
[]=(key, val) click to toggle source

    # File lib/racc/iset.rb, line 31
    def []=(key, val)
      @set[key.ident] = val
    end

add(i) click to toggle source

    # File lib/racc/iset.rb, line 23
    def add(i)
      @set[i.ident] = i
    end

clear() click to toggle source

    # File lib/racc/iset.rb, line 81
    def clear
      @set.clear
    end

delete(key) click to toggle source

    # File lib/racc/iset.rb, line 53
    def delete(key)
      i = @set[key.ident]
      @set[key.ident] = nil
      i
    end

dup() click to toggle source

    # File lib/racc/iset.rb, line 85
    def dup
      ISet.new(@set.dup)
    end

each(&block) click to toggle source

    # File lib/racc/iset.rb, line 59
    def each(&block)
      @set.compact.each(&block)
    end

empty?() click to toggle source

    # File lib/racc/iset.rb, line 77
    def empty?
      @set.nitems == 0
    end

include?(key) click to toggle source
Alias for: []
inspect() click to toggle source
Alias for: to_s
key?(key) click to toggle source
Alias for: []
size() click to toggle source

    # File lib/racc/iset.rb, line 73
    def size
      @set.nitems
    end

to_a() click to toggle source

    # File lib/racc/iset.rb, line 63
    def to_a
      @set.compact
    end

to_s() click to toggle source

    # File lib/racc/iset.rb, line 67
    def to_s
      "[#{@set.compact.join(' ')}]"
    end

Also aliased as: inspect
update(other) click to toggle source

    # File lib/racc/iset.rb, line 38
    def update(other)
      s = @set
      o = other.set
      o.each_index do |idx|
        if t = o[idx]
          s[idx] = t
        end
      end
    end

update_a(a) click to toggle source

    # File lib/racc/iset.rb, line 48
    def update_a(a)
      s = @set
      a.each {|i| s[i.ident] = i }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.