class Cxxproject::Utils::GraphStream

Public Class Methods

new() click to toggle source
# File lib/cxxproject/utils/graphstream.rb, line 8
def initialize
  begin
    @server = TCPSocket.open('localhost', 31217)
    @queue = Queue.new
    Thread.new do
      while true
        command = @queue.pop
        @server.puts(command)
      end
    end
  rescue Exception => bang
    puts bang
  end
end

Public Instance Methods

add_edge(from, to) click to toggle source
# File lib/cxxproject/utils/graphstream.rb, line 36
def add_edge(from, to)
  send("AddEdge(#{from},#{to})")
end
add_vertex(id) click to toggle source
# File lib/cxxproject/utils/graphstream.rb, line 33
def add_vertex(id)
  send("AddVertex(#{id})")
end
clear() click to toggle source
# File lib/cxxproject/utils/graphstream.rb, line 26
def clear
  send('Clear()')
end
send(command) click to toggle source
# File lib/cxxproject/utils/graphstream.rb, line 22
def send(command)
  @queue << command
end
set_class(id, clazz) click to toggle source
# File lib/cxxproject/utils/graphstream.rb, line 39
def set_class(id, clazz)
  send("SetClass(#{id},#{clazz})")
end
set_stylesheet(s) click to toggle source
# File lib/cxxproject/utils/graphstream.rb, line 30
def set_stylesheet(s)
  send("SetStylesheet(#{s})")
end