Class: Roby::Distributed::Neighbour

Inherits:
Object
  • Object
show all
Defined in:
lib/roby/distributed/connection_space.rb

Overview

A neighbour is a [name, remote_id] tuple, where name is the name of the neighbour and remote_id the RemoteID which describes the remote ConnectionSpace, used to connect to it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, remote_id) ⇒ Neighbour

Returns a new instance of Neighbour.



17
18
19
# File 'lib/roby/distributed/connection_space.rb', line 17

def initialize(name, remote_id)
		@name, @remote_id = name, remote_id
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/roby/distributed/connection_space.rb', line 16

def name
  @name
end

#remote_idObject (readonly)

Returns the value of attribute remote_id.



16
17
18
# File 'lib/roby/distributed/connection_space.rb', line 16

def remote_id
  @remote_id
end

Instance Method Details

#==(other) ⇒ Object



22
23
24
25
# File 'lib/roby/distributed/connection_space.rb', line 22

def ==(other)
		other.kind_of?(Neighbour) &&
 (remote_id == other.remote_id)
end

#connectObject



21
# File 'lib/roby/distributed/connection_space.rb', line 21

def connect; Peer.initiate_connection(ConnectionSpace.state, peer) end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


27
# File 'lib/roby/distributed/connection_space.rb', line 27

def eql?(other); other == self end

#to_sObject



26
# File 'lib/roby/distributed/connection_space.rb', line 26

def to_s; "#<Neighbour:#{name} #{remote_id}>" end