Class Area

java.lang.Object
   |
   +----Area

public class Area
extends Object
Class definition for a site in an ATM network.

Version:
$Revision: 1.14 $, $Date: 2000/10/30 17:02:53 $
Author:
John Cavanaugh

Variable Index

 o ALLOWED
A node is explicitly allowed in an area.
 o ALLOWED_DEFAULT
A node is allowed in an area by default (the area is a user- provided default area).
 o ALLOWED_WEAK_DEFAULT
A node is allowed in an area by weak default (the area is the program-provided default area).
 o allowedNodes
A list of names of the nodes that are allowed in the area.
 o config
The configuration the area is part of.
 o DEFAULT
 o HASH_TABLE_SIZE
 o height
The height of the area, expressed as a fraction (0.0 to 1.0) of the height of the display window.
 o icon
The rectangle that represents the area on the display.
 o loc
The display location of the upper left-hand corner of the area, expressed as fractions of the width and height of the display window.
 o name
The name of the area.
 o nodes
A list of the nodes that are members of the area.
 o NOT_ALLOWED
A node is not allowed in an area.
 o PROG_DEFAULT
 o SEL_SQ_SIZE
 o selected
The selection status of the area; true if the area is selected on the display.
 o visible
A flag indicating whether the area is visible.
 o width
The width of the area, expressed as a fraction (0.0 to 1.0) of the width of the display window.

Constructor Index

 o Area()
Constructs an area with default settings.
 o Area(Area)
Constructs an area by copying another area.
 o Area(VisiConfig, String, double, double, double, double)
Constructs an area given its name, location, and size.

Method Index

 o add(Node)
Add a node to the area.
 o addAllowedNode(Node, PointDouble)
Add a node to the list of nodes that are allowed to be members of the area.
 o addAllowedNode(String, PointDouble)
Add a node to the list of nodes that are allowed to be members of the area.
 o clearAllowedNodes()
Clears the list of allowed nodes.
 o contains(Object)
Check whether a node is a member of the area.
 o countSwitches()
Count the switches in the area.
 o createIcon(ViewSettings)
Create and save the display icon for the area.
 o draw(Graphics, ViewSettings)
Draw the area in the display window.
 o drawLabel(Graphics, ViewSettings)
Draw a label in an area's rectangle in the display window.
 o getAllowedEnumeration()
Get an enumeration over the list of the nodes allowed in the area
 o getAllowedLocation(Node)
Get the location of a node that is allowed in the area.
 o getAllowedLocation(String)
Get the location of a node that is allowed in the area.
 o getConfig()
Get the area's configuration.
 o getHeight()
Get the relative height of the area.
 o getIcon()
Get the area's screen icon.
 o getLoc()
Get the area's relative location.
 o getName()
Get the area's name.
 o getNodeEnumeration()
Get an enumeration over the members of the area.
 o getNodeLoc(Rectangle, Rectangle)
Find the relative location of a node within an area.
 o getWidth()
Get the relative width of the area.
 o getX()
Get the relative X coordinate of the upper left corner of the area.
 o getY()
Get the relative Y coordinate of the upper left corner of the area.
 o isAllowed(Node)
Check whether a given node is allowed in the area.
 o isAllowed(String)
Check whether a given node is allowed in the area.
 o isSelected()
Check whether the area is selected.
 o isValidName(String)
Determine whether a string represents a valid area name.
 o isVisible()
Check whether the are is visible on the display.
 o positionAreaAuto(ViewSettings)
Dynamically select positions for the nodes in the area.
 o positionAreaByConfig()
Set positions for the nodes in the area based on their configured positions.
 o positionSwitchHosts(Switch, double, double)
Set display locations for all the hosts attached to a given switch.
 o remove(Node)
Remove a member node from the area.
 o removeAllMembers()
Remove all member nodes from the area.
 o removeAllowedNode(Node)
Remove a node from the list of nodes that are allowed to be members of the area.
 o removeAllowedNode(String)
Remove a node from the list of nodes that are allowed to be members of the area.
 o reposition(ViewSettings)
Select display locations for the switches and hosts in the area.
 o setAllowedLocation(Node, PointDouble)
Set the location for a node that is allowed in the area.
 o setAllowedLocation(String, PointDouble)
Set the location for a node that is allowed in the area.
 o setConfig(VisiConfig)
Set the area's configuration.
 o setHeight(double)
Set the relative height of the area.
 o setIcon(Rectangle)
Set area's screen icon.
 o setLoc(PointDouble)
Set the area's relative location
 o setName(String)
Set the area's name.
 o setSelected(boolean)
Set the area's selection status.
 o setVisible(boolean)
Set whether the are is visible on the display.
 o setWidth(double)
Set the relative width of the area.
 o setX(double)
Set the relative X coordinate of the upper left corner of the area.
 o setY(double)
Set the relative Y coordinate of the upper left corner of the area.
 o toString()
Get a string describing the area
 o whichEdge(Point)
Find which edge of a selected area, if any, the cursor is on.

Variables

 o NOT_ALLOWED
 public static final int NOT_ALLOWED
A node is not allowed in an area.

 o ALLOWED_WEAK_DEFAULT
 public static final int ALLOWED_WEAK_DEFAULT
A node is allowed in an area by weak default (the area is the program-provided default area).

 o ALLOWED_DEFAULT
 public static final int ALLOWED_DEFAULT
A node is allowed in an area by default (the area is a user- provided default area).

 o ALLOWED
 public static final int ALLOWED
A node is explicitly allowed in an area.

 o HASH_TABLE_SIZE
 private static final int HASH_TABLE_SIZE
 o config
 private VisiConfig config
The configuration the area is part of.

 o loc
 private PointDouble loc
The display location of the upper left-hand corner of the area, expressed as fractions of the width and height of the display window.

 o height
 private double height
The height of the area, expressed as a fraction (0.0 to 1.0) of the height of the display window.

 o width
 private double width
The width of the area, expressed as a fraction (0.0 to 1.0) of the width of the display window.

 o name
 private String name
The name of the area. "Default" and "~~Default" have special meanings, otherwise the name is not significant.

 o DEFAULT
 public static final String DEFAULT
 o PROG_DEFAULT
 public static final String PROG_DEFAULT
 o visible
 private boolean visible
A flag indicating whether the area is visible.

 o nodes
 private Vector nodes
A list of the nodes that are members of the area. Each entry is a Node (Switch or Endsystem) object.

 o allowedNodes
 private Hashtable allowedNodes
A list of names of the nodes that are allowed in the area. Each entry is an AreaMember object.

 o icon
 private Rectangle icon
The rectangle that represents the area on the display. It is the actual (i.e. number of pixels) location and size of the area as it is displayed.

 o selected
 private boolean selected
The selection status of the area; true if the area is selected on the display. Only one area can be selected at a time.

 o SEL_SQ_SIZE
 private static final int SEL_SQ_SIZE

Constructors

 o Area
 public Area(VisiConfig config,
             String name,
             double x,
             double y,
             double width,
             double height)
Constructs an area given its name, location, and size.

Parameters:
config - the configuratin the area is part of.
name - the name of the area.
x - the relative X offset of the area in the display window.
y - the relative Y offset of the area in the display window.
width - the relative width of the area.
height - the relative height of the area.
 o Area
 public Area(Area area)
Constructs an area by copying another area.

Parameters:
eter - a the area to be copied.
 o Area
 public Area()
Constructs an area with default settings.

Methods

 o add
 public void add(Node node)
Add a node to the area.

Parameters:
node - the node to be added to the area.
 o remove
 public void remove(Node node)
Remove a member node from the area.

Parameters:
node - the node to be removed.
 o removeAllMembers
 public void removeAllMembers()
Remove all member nodes from the area.

 o contains
 public boolean contains(Object o)
Check whether a node is a member of the area.

Parameters:
o - the object whose membership is in question.
Returns:
true if the node is a member of the area; false otherwise.
 o addAllowedNode
 public void addAllowedNode(Node node,
                            PointDouble loc)
Add a node to the list of nodes that are allowed to be members of the area.

Parameters:
node - the node to be added.
loc - the relative location of the node in the area.
 o addAllowedNode
 public void addAllowedNode(String addr,
                            PointDouble loc)
Add a node to the list of nodes that are allowed to be members of the area.

Parameters:
name - the name of the node to be added.
loc - the relative location of the node in the area.
 o removeAllowedNode
 public void removeAllowedNode(Node node)
Remove a node from the list of nodes that are allowed to be members of the area.

Parameters:
node - the node to be removed.
 o removeAllowedNode
 public void removeAllowedNode(String name)
Remove a node from the list of nodes that are allowed to be members of the area.

Parameters:
name - the name of the node to be removed.
 o clearAllowedNodes
 public void clearAllowedNodes()
Clears the list of allowed nodes.

 o isAllowed
 public int isAllowed(Node node)
Check whether a given node is allowed in the area.

Parameters:
node - the node.
Returns:
an indication of the node's status in the area; NOT_ALLOWED, ALLOWED_WEAK_DEFAULT, ALLOWED_DEFAULT, or ALLOWED.
 o isAllowed
 public int isAllowed(String name)
Check whether a given node is allowed in the area.

Parameters:
name - the name of the node.
Returns:
an indication of the node's status in the area; NOT_ALLOWED, ALLOWED_WEAK_DEFAULT, ALLOWED_DEFAULT, or ALLOWED.
 o getAllowedLocation
 public PointDouble getAllowedLocation(Node node)
Get the location of a node that is allowed in the area.

Parameters:
node - the node whose location is to be found.
Returns:
the node's location.
 o getAllowedLocation
 public PointDouble getAllowedLocation(String name)
Get the location of a node that is allowed in the area.

Parameters:
name - the name of the node whose location is to be found.
Returns:
the node's location; null if there none.
 o setAllowedLocation
 public void setAllowedLocation(Node node,
                                PointDouble loc)
Set the location for a node that is allowed in the area. The node may or may not currently be a member of the area.

Parameters:
node - the node whose location is to be set.
loc - the new location for the node.
 o setAllowedLocation
 public void setAllowedLocation(String name,
                                PointDouble loc)
Set the location for a node that is allowed in the area. The node may or may not currently be a member of the area.

Parameters:
name - the name of the node whose location is to be set.
loc - the new location for the node.
 o countSwitches
 public int countSwitches()
Count the switches in the area.

Returns:
the number of switches that are members of the area.
 o reposition
 public void reposition(ViewSettings view)
Select display locations for the switches and hosts in the area.

Parameters:
view - the view settings in effect
 o positionAreaAuto
 private void positionAreaAuto(ViewSettings view)
Dynamically select positions for the nodes in the area.

Parameters:
view - the view settings in effect
 o positionAreaByConfig
 private void positionAreaByConfig()
Set positions for the nodes in the area based on their configured positions.

 o positionSwitchHosts
 private void positionSwitchHosts(Switch sw,
                                  double psi,
                                  double range)
Set display locations for all the hosts attached to a given switch.

Parameters:
s - the switch the hosts are attached to.
psi - the angle from the switch to the center of the area.
range - the angle over which the hosts are to be distributed.
 o draw
 public void draw(Graphics g,
                  ViewSettings view)
Draw the area in the display window.

Parameters:
g - the graphics context for drawing.
view - the view settings.
 o drawLabel
 private void drawLabel(Graphics g,
                        ViewSettings view)
Draw a label in an area's rectangle in the display window. The label is centered along the bottom side of the rectangle.

Parameters:
g - the graphics context for drawing.
view - the view settings.
 o getNodeLoc
 public static PointDouble getNodeLoc(Rectangle a,
                                      Rectangle n)
Find the relative location of a node within an area.

Parameters:
a - a Rectangle describing the area.
n - a Rectangle describing the node.
Returns:
a PointDouble with the relative location of the node in the area.
 o whichEdge
 public int whichEdge(Point cursorLoc)
Find which edge of a selected area, if any, the cursor is on.

Parameters:
cursroLoc - the location of the cursor.
 o isValidName
 public static boolean isValidName(String name)
Determine whether a string represents a valid area name.

Parameters:
name - the name to be checked.
Returns:
true if name is a legal area name; false otherwise.
 o getConfig
 public VisiConfig getConfig()
Get the area's configuration.

Returns:
the configuration the area is in.
 o setConfig
 public void setConfig(VisiConfig config)
Set the area's configuration.

Parameters:
config - the configuration the area is in.
 o getName
 public String getName()
Get the area's name.

Returns:
a string containing the area's name.
 o setName
 public void setName(String n)
Set the area's name.

Parameters:
n - the name for the area.
 o isVisible
 public boolean isVisible()
Check whether the are is visible on the display.

Returns:
true if the area is visible; false otherwise.
 o setVisible
 public void setVisible(boolean visible)
Set whether the are is visible on the display.

Parameters:
visible - true if the area is visible; false otherwise.
 o getLoc
 public PointDouble getLoc()
Get the area's relative location.

Returns:
a PointDouble containing the area's relative location in the display window.
See Also:
loc
 o setLoc
 public void setLoc(PointDouble loc)
Set the area's relative location

Parameters:
loc - the new location.
See Also:
loc
 o getX
 public double getX()
Get the relative X coordinate of the upper left corner of the area.

Returns:
A double with the relative X coordinate of the upper left corner of the area.
See Also:
loc
 o setX
 public void setX(double x)
Set the relative X coordinate of the upper left corner of the area.

Parameters:
x - the relative X coordinate of the upper left corner of the area.
See Also:
loc
 o getY
 public double getY()
Get the relative Y coordinate of the upper left corner of the area.

Returns:
a double with the relative Y coordinate of the upper left corner of the area.
See Also:
loc
 o setY
 public void setY(double y)
Set the relative Y coordinate of the upper left corner of the area.

Parameters:
y - the relative Y coordinate of the upper left corner of the area.
See Also:
loc
 o getWidth
 public double getWidth()
Get the relative width of the area.

Returns:
a double with the relative width of the area.
See Also:
width
 o setWidth
 public void setWidth(double width)
Set the relative width of the area.

Parameters:
width - the relative width of the area.
See Also:
width
 o getHeight
 public double getHeight()
Get the relative height of the area.

Returns:
a double with the relative height of the area.
See Also:
height
 o setHeight
 public void setHeight(double height)
Set the relative height of the area.

Parameters:
height - the relative height of the area.
See Also:
height
 o getIcon
 public Rectangle getIcon()
Get the area's screen icon.

Returns:
a Rectangle that specifies the area's appearance in the display window.
 o setIcon
 public void setIcon(Rectangle r)
Set area's screen icon.

Parameters:
r - a Rectangle that specifies the area's appearance in the display window.
 o createIcon
 private void createIcon(ViewSettings view)
Create and save the display icon for the area.

Parameters:
view - the view settings for the display.
 o getNodeEnumeration
 public Enumeration getNodeEnumeration()
Get an enumeration over the members of the area.

Returns:
an Enumeration over the nodes that are members of the area.
 o getAllowedEnumeration
 public Enumeration getAllowedEnumeration()
Get an enumeration over the list of the nodes allowed in the area

Returns:
an Enumeratoin over the nodes that are allowed in the area.
 o isSelected
 public boolean isSelected()
Check whether the area is selected.

Returns:
true if the area is selected; false otherwise.
 o setSelected
 public void setSelected(boolean b)
Set the area's selection status.

Parameters:
b - a boolean indicating whether the area is now selected.
 o toString
 public String toString()
Get a string describing the area

Returns:
a string describing the area object.
Overrides:
toString in class Object