Class: Fox::FXDict
- Defined in:
- rdoc-sources/FXDict.rb,
lib/fox16/dict.rb
Overview
The dictionary class maintains a fast-access hash table of entities indexed by a character string. It is typically used to map strings to pointers; however, derived classes may allow any type of data to be indexed by strings.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#first ⇒ Object
readonly
Position of first filled slot, or >= total [Integer].
-
#last ⇒ Object
readonly
Position of last filled slot, or -1 [Integer].
-
#length ⇒ Object
(also: #size)
readonly
Total number of entries in the table [Integer].
Instance Method Summary collapse
-
#clear ⇒ Object
Clear all entries.
-
#each_key ⇒ Object
Iterate over the keys in this dictionary.
-
#empty? ⇒ Boolean
Returns
true
if this dictionary contains no key-value pairs. -
#has_key?(key) ⇒ Boolean
(also: #include?, #member?)
Returns
true
if the given key is present. -
#initialize ⇒ FXDict
constructor
Construct an empty dictionary.
-
#key(pos) ⇒ Object
Return key at position pos.
-
#keys ⇒ Object
Returns a new array populated with the keys from this dictionary.
-
#marked?(pos) ⇒ Boolean
Return mark flag of entry at position pos.
-
#next(pos) ⇒ Object
Return position of next filled slot after pos in the hash table, or a value greater than or equal to total if no filled slot was found.
-
#prev(pos) ⇒ Object
Return position of previous filled slot before pos in the hash table, or a -1 if no filled slot was found.
Methods inherited from FXObject
#bind, #handle, #load, #save, subclasses
Constructor Details
#initialize ⇒ FXDict
Construct an empty dictionary.
24 |
# File 'rdoc-sources/FXDict.rb', line 24 def initialize ; end |
Instance Attribute Details
#first ⇒ Object (readonly)
Position of first filled slot, or >= total [Integer]
14 15 16 |
# File 'rdoc-sources/FXDict.rb', line 14 def first @first end |
#last ⇒ Object (readonly)
Position of last filled slot, or -1 [Integer]
17 18 19 |
# File 'rdoc-sources/FXDict.rb', line 17 def last @last end |
#length ⇒ Object (readonly) Also known as: size
Total number of entries in the table [Integer]
11 12 13 |
# File 'rdoc-sources/FXDict.rb', line 11 def length @length end |
Instance Method Details
#clear ⇒ Object
Clear all entries
52 |
# File 'rdoc-sources/FXDict.rb', line 52 def clear() ; end |
#each_key ⇒ Object
Iterate over the keys in this dictionary.
57 58 |
# File 'rdoc-sources/FXDict.rb', line 57 def each_key # :yields: key end |
#empty? ⇒ Boolean
Returns true
if this dictionary contains no key-value pairs.
76 |
# File 'rdoc-sources/FXDict.rb', line 76 def empty?() ; end |
#has_key?(key) ⇒ Boolean Also known as: include?, member?
Returns true
if the given key is present.
68 |
# File 'rdoc-sources/FXDict.rb', line 68 def has_key?(key) ; end |
#key(pos) ⇒ Object
Return key at position pos.
29 |
# File 'rdoc-sources/FXDict.rb', line 29 def key(pos) ; end |
#keys ⇒ Object
Returns a new array populated with the keys from this dictionary.
63 |
# File 'rdoc-sources/FXDict.rb', line 63 def keys() ; end |
#marked?(pos) ⇒ Boolean
Return mark flag of entry at position pos.
34 |
# File 'rdoc-sources/FXDict.rb', line 34 def marked?(pos) ; end |
#next(pos) ⇒ Object
Return position of next filled slot after pos in the hash table, or a value greater than or equal to total if no filled slot was found.
41 |
# File 'rdoc-sources/FXDict.rb', line 41 def next(pos) ; end |
#prev(pos) ⇒ Object
Return position of previous filled slot before pos in the hash table, or a -1 if no filled slot was found.
47 |
# File 'rdoc-sources/FXDict.rb', line 47 def prev(pos) ; end |