All Packages Class Hierarchy This Package Previous Next Index
Class vnet.NetLayout
java.lang.Object
|
+----java.util.Observable
|
+----vnet.NetLayout
- public class NetLayout
- extends Observable
- implements Observer
Class to represent the virtual net layout
It is a representation of nodes (machines) and links (communication channels)
where any node or link can fail.
This net layout only simulates only the physical layout, that is, it manages
the adding or removing of nodes and links in the net, but not the binding,
unbinding or lookup of servers in the net.
It implements the Observable function of the observer pattern.
- Version:
- 0.1, august-1997
- Author:
- LuisM Pena
-
NetLayout()
- Default constructor
-
NetLayout(long)
- This constructor allows to specify the default delay that will apply for the
nodes and links in the net.
-
addLink(LinkId, NodeId, NodeId)
- Inserts a new link in the net, with the default delay
The observers of the netlayout will receive a VirtualNetEvent notification,
with the new link inside
-
addLink(LinkId, NodeId, NodeId, long)
- Inserts a new link in the net, with the specified delay
The observers of the netlayout will receive a VirtualNetEvent notification,
with the new link inside
-
addNode(NodeId)
- Inserts a new node in the net, with the default delay
The observers of the netlayout will receive a VirtualNetEvent notification,
with the new node inside
-
addNode(NodeId, long)
- Inserts a new node in the net, with the specified delay
The observers of the netlayout will receive a VirtualNetEvent notification,
with the new node inside
-
destroy()
- This is the destructor: destroy the nodes of the net, who destroy themselves
the links, notifying all this events to the observes.
-
getLinks()
- Gets the links included in the net
-
getNode(NodeId)
- Gets the NetNode of the net with the specified id
-
getNodes()
- Gets the nodes included in the net
-
removeLink(LinkId)
- Removes a Link out of the net.
-
removeNode(NodeId)
- Removes a Node out of the net.
-
setNetDelay(long)
- Sets an additional delay that applies to every message operation between nodes
(and links)
-
update(Observable, Object)
- Observable method
NetLayout
public NetLayout()
- Default constructor
NetLayout
public NetLayout(long delay)
- This constructor allows to specify the default delay that will apply for the
nodes and links in the net.
- Parameters:
- delay - the delay that will apply by default to the nodes and links
destroy
public void destroy() throws VNException
- This is the destructor: destroy the nodes of the net, who destroy themselves
the links, notifying all this events to the observes.
- Throws: VNException
- if any NetNode.destroy() fails
- See Also:
- destroy
addNode
public void addNode(NodeId id) throws VNException
- Inserts a new node in the net, with the default delay
The observers of the netlayout will receive a VirtualNetEvent notification,
with the new node inside
- Parameters:
- id - the Node identity
- Throws: VNException
- if the NodeId has already been added to the net
- See Also:
- NetLayout
addNode
public synchronized void addNode(NodeId id,
long delay) throws VNException
- Inserts a new node in the net, with the specified delay
The observers of the netlayout will receive a VirtualNetEvent notification,
with the new node inside
- Parameters:
- id - the Node identity
- delay - the expected delay
- Throws: VNException
- if the NodeId has already been added to the net
removeNode
public synchronized void removeNode(NodeId id) throws VNException
- Removes a Node out of the net.
- Parameters:
- id - the Node identity
- Throws: VNException
- if the NodeId doesn't allow to the net
addLink
public void addLink(LinkId id,
NodeId idA,
NodeId idB) throws VNException
- Inserts a new link in the net, with the default delay
The observers of the netlayout will receive a VirtualNetEvent notification,
with the new link inside
- Parameters:
- id - the Link identity
- idA - any of the two nodes associated to this link
- idB - the another node
- Throws: VNException
- if the LinkId has already been added to the net, or if
the nodes don't allow to the net.
- See Also:
- NetLayout
addLink
public synchronized void addLink(LinkId id,
NodeId idA,
NodeId idB,
long delay) throws VNException
- Inserts a new link in the net, with the specified delay
The observers of the netlayout will receive a VirtualNetEvent notification,
with the new link inside
- Parameters:
- id - the Link identity
- idA - any of the two nodes associated to this link
- idB - the another node
- delay - the expected delay
- Throws: VNException
- if the LinkId has already been added to the net, or if
the nodes don't allow to the net.
removeLink
public synchronized void removeLink(LinkId id) throws VNException
- Removes a Link out of the net.
- Parameters:
- id - the Link identity
- Throws: VNException
- if the LinkId doesn't allow to the net or the destroy()
NetLink method fails
- See Also:
- destroy
setNetDelay
public static void setNetDelay(long delay)
- Sets an additional delay that applies to every message operation between nodes
(and links)
- Parameters:
- delay - the delay in milliseconds
getNodes
public synchronized Enumeration getNodes()
- Gets the nodes included in the net
- Returns:
- the nodes in the net
getLinks
public synchronized Enumeration getLinks()
- Gets the links included in the net
- Returns:
- the links in the net
update
public synchronized void update(Observable o,
Object arg)
- Observable method
getNode
public synchronized NetNode getNode(NodeId id) throws VNException
- Gets the NetNode of the net with the specified id
- Parameters:
- id - the NodId to look for
- Returns:
- the NetNode with the specified id
- Throws: VNException
- if there is no NetNode with such NodeId
All Packages Class Hierarchy This Package Previous Next Index