In Files

  • tk/lib/tkextlib/blt/vector.rb

Class/Module Index [+]

Quicksearch

Tk::BLT::Vector

Constants

TkCommandNames

Public Class Methods

create(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 14
def self.create(*args)
  tk_call('::blt::vector', 'create', *args)
end
            
destroy(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 18
def self.destroy(*args)
  tk_call('::blt::vector', 'destroy', *args)
end
            
expr(expression) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 22
def self.expr(expression)
  tk_call('::blt::vector', 'expr', expression)
end
            
names(pat=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 26
def self.names(pat=None)
  list = simplelist(tk_call('::blt::vector', 'names', pat))
  TkVar_ID_TBL.mutex.synchronize{
    list.collect{|name|
      if TkVar_ID_TBL[name]
        TkVar_ID_TBL[name]
      elsif name[0..1] == '::' && TkVar_ID_TBL[name[2..-1]]
        TkVar_ID_TBL[name[2..-1]]
      else
        name
      end
    }
  }
end
            
new(size=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 43
def initialize(size=nil, keys={})
  if size.kind_of?(Hash)
    keys = size
    size = nil
  end
  if size.kind_of?(Array)
    # [first, last]
    size = size.join(':')
  end
  if size
    @id = TkCore::INTERP._invoke('::blt::vector', 'create',
                                 "#auto(#{size})", *hash_kv(keys))
  else
    @id = TkCore::INTERP._invoke('::blt::vector', 'create',
                                 "#auto", *hash_kv(keys))
  end

  TkVar_ID_TBL.mutex.synchronize{
    TkVar_ID_TBL[@id] = self
  }

  @def_default = false
  @default_val = nil

  @trace_var  = nil
  @trace_elem = nil
  @trace_opts = nil

  # teach Tk-ip that @id is global var
  TkCore::INTERP._invoke_without_enc('global', @id)
end
            

Public Instance Methods

*(item) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 87
def *(item)
  list(tk_call(@id, '*', item))
end
            
+(item) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 91
def +(item)
  list(tk_call(@id, '+', item))
end
            
-(item) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 95
def -(item)
  list(tk_call(@id, '-', item))
end
            
/(item) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 99
def /(item)
  list(tk_call(@id, '/', item))
end
            
[](idx) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 141
def [](idx)
  index(idx)
end
            
[]=(idx, val) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 145
def []=(idx, val)
  index(idx, val)
end
            
append(*vectors) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 103
def append(*vectors)
  tk_call(@id, 'append', *vectors)
end
            
binread(channel, len=None, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 107
def binread(channel, len=None, keys={})
  if len.kind_of?(Hash)
    keys = len
    len = None
  end
  keys = _symbolkey2str(keys)
  keys['swap'] = None if keys.delete('swap')
  tk_call(@id, 'binread', channel, len, keys)
end
            
clear() click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 117
def clear()
  tk_call(@id, 'clear')
  self
end
            
delete(*indices) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 122
def delete(*indices)
  tk_call(@id, 'delete', *indices)
  self
end
            
destroy() click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 75
def destroy
  tk_call('::blt::vector', 'destroy', @id)
end
            
dup_vector(vec) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 127
def dup_vector(vec)
  tk_call(@id, 'dup', vec)
  self
end
            
expr(expression) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 132
def expr(expression)
  tk_call(@id, 'expr', expression)
  self
end
            
index(idx, val=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 137
def index(idx, val=None)
  number(tk_call(@id, 'index', idx, val))
end
            
inspect() click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 79
def inspect
  '#<Tk::BLT::Vector: ' + @id + '>'
end
            
length() click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 149
def length()
  number(tk_call(@id, 'length'))
end
            
length=(size) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 153
def length=(size)
  number(tk_call(@id, 'length', size))
end
            
merge(*vectors) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 157
def merge(*vectors)
  tk_call(@id, 'merge', *vectors)
  self
end
            
normalize(vec=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 162
def normalize(vec=None)
  tk_call(@id, 'normalize', vec)
  self
end
            
notify(keyword) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 167
def notify(keyword)
  tk_call(@id, 'notify', keyword)
  self
end
            
offset() click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 172
def offset()
  number(tk_call(@id, 'offset'))
end
            
offset=(val) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 176
def offset=(val)
  number(tk_call(@id, 'offset', val))
end
            
populate(vector, density=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 184
def populate(vector, density=None)
  tk_call(@id, 'populate', vector, density)
  self
end
            
random() click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 180
def random()
  tk_call(@id, 'random')
end
            
range(first, last=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 189
def range(first, last=None)
  list(tk_call(@id, 'range', first, last))
end
            
search(val1, val2=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 193
def search(val1, val2=None)
  list(tk_call(@id, 'search', val1, val2))
end
            
seq(start, finish=None, step=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 202
def seq(start, finish=None, step=None)
  tk_call(@id, 'seq', start, finish, step)
  self
end
            
set(item) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 197
def set(item)
  tk_call(@id, 'set', item)
  self
end
            
sort(*vectors) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 207
def sort(*vectors)
  tk_call(@id, 'sort', *vectors)
  self
end
            
sort_reverse(*vectors) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 212
def sort_reverse(*vectors)
  tk_call(@id, 'sort', '-reverse', *vectors)
  self
end
            
split(*vectors) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 217
def split(*vectors)
  tk_call(@id, 'split', *vectors)
  self
end
            
to_s() click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 83
def to_s
  @id
end
            
variable(var) click to toggle source
 
               # File tk/lib/tkextlib/blt/vector.rb, line 222
def variable(var)
  tk_call(@id, 'variable', var)
  self
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.