Class Switch

java.lang.Object
   |
   +----VisiModel.ATMNode
           |
           +----Node
                   |
                   +----Switch

public class Switch
extends Node
Class definition for a displayable representation of an ATM switch in an IP/ATM network.

Version:
$Revision: 1.11 $, $Date: 2000/10/30 17:02:54 $
Author:
John Cavanaugh

Variable Index

 o control
The control processor for the switch.
 o ORPHAN
A description identifying the switch as a virtual home for orphan hosts.
 o SWITCH_ICON_SIZE
The display size of the square representing the switch.

Constructor Index

 o Switch(String, Network, String, EndSystem, long)
Constructs a switch.

Method Index

 o draw(Graphics, ViewSettings)
Draws the switch in the display window.
 o drawLabel(Graphics, ViewSettings)
Draws the switch's label.
 o findMaxBandwidth()
Finds the maximum bandwidth, in cells per second, of any port on the switch.
 o getControl()
Gets the control processor for the switch.
 o labelIntersects(Rectangle)
Checks whether the given rectangle intersects any of the physical connection lines for the switch.
 o merge(ATMNode)
Merges the switch with another.
 o setScreenLocation(Point)
Sets the switch's display location; overrides setScreenLocation() in Node.
 o toString()
Gets a string describing the switch.

Variables

 o SWITCH_ICON_SIZE
 public static final int SWITCH_ICON_SIZE
The display size of the square representing the switch.

 o ORPHAN
 public static final String ORPHAN
A description identifying the switch as a virtual home for orphan hosts.

 o control
 private EndSystem control
The control processor for the switch.

Constructors

 o Switch
 public Switch(String name,
               Network net,
               String description,
               EndSystem control,
               long flags)
Constructs a switch.

Parameters:
name - a name for the switch.
net - the network the switch is part of.
description - a description of the switch.
control - the control processor for the switch.
flags - attribute flags for the switch.

Methods

 o draw
 public void draw(Graphics g,
                  ViewSettings view)
Draws the switch in the display window.

Parameters:
g - the graphics context for the display window.
view - the view settings.
Overrides:
draw in class Node
 o drawLabel
 protected void drawLabel(Graphics g,
                          ViewSettings view)
Draws the switch's label. This code attempts to place the label so that it does not intersect any of the lines for physical connections to the switch.

Parameters:
g - the grahics context for the display window.
view - the view settings.
Overrides:
drawLabel in class Node
 o labelIntersects
 private boolean labelIntersects(Rectangle rect)
Checks whether the given rectangle intersects any of the physical connection lines for the switch.

Parameters:
rect - the rectangle to be checked for intersections.
Returns:
true if the proposed location is OK; false if the proposed location intersects a line.
 o setScreenLocation
 public void setScreenLocation(Point loc)
Sets the switch's display location; overrides setScreenLocation() in Node.

Parameters:
loc - the switch's location in the display window.
Overrides:
setScreenLocation in class Node
 o findMaxBandwidth
 public long findMaxBandwidth()
Finds the maximum bandwidth, in cells per second, of any port on the switch.

Returns:
the switch's maximum bandwidth.
 o getControl
 public EndSystem getControl()
Gets the control processor for the switch.

Returns:
the switch's control processor.
 o merge
 public void merge(ATMNode node)
Merges the switch with another.

Parameters:
node - the node to merge with this switch.
Overrides:
merge in class Node
 o toString
 public String toString()
Gets a string describing the switch.

Returns:
a string describing the switch object.
Overrides:
toString in class Node