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
-
ALLOWED
- A node is explicitly allowed in an area.
-
ALLOWED_DEFAULT
- A node is allowed in an area by default (the area is a user-
provided default area).
-
ALLOWED_WEAK_DEFAULT
- A node is allowed in an area by weak default (the area is the
program-provided default area).
-
allowedNodes
- A list of names of the nodes that are allowed in the area.
-
config
- The configuration the area is part of.
-
DEFAULT
-
-
HASH_TABLE_SIZE
-
-
height
- The height of the area, expressed as a fraction (0.0 to 1.0)
of the height of the display window.
-
icon
- The rectangle that represents the area on the display.
-
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.
-
name
- The name of the area.
-
nodes
- A list of the nodes that are members of the area.
-
NOT_ALLOWED
- A node is not allowed in an area.
-
PROG_DEFAULT
-
-
SEL_SQ_SIZE
-
-
selected
- The selection status of the area; true if the area is
selected on the display.
-
visible
- A flag indicating whether the area is visible.
-
width
- The width of the area, expressed as a fraction (0.0 to 1.0)
of the width of the display window.
-
Area()
- Constructs an area with default settings.
-
Area(Area)
- Constructs an area by copying another area.
-
Area(VisiConfig, String, double, double, double, double)
- Constructs an area given its name, location, and size.
-
add(Node)
- Add a node to the area.
-
addAllowedNode(Node, PointDouble)
- Add a node to the list of nodes that are allowed to
be members of the area.
-
addAllowedNode(String, PointDouble)
- Add a node to the list of nodes that are allowed to
be members of the area.
-
clearAllowedNodes()
- Clears the list of allowed nodes.
-
contains(Object)
- Check whether a node is a member of the area.
-
countSwitches()
- Count the switches in the area.
-
createIcon(ViewSettings)
- Create and save the display icon for the area.
-
draw(Graphics, ViewSettings)
- Draw the area in the display window.
-
drawLabel(Graphics, ViewSettings)
- Draw a label in an area's rectangle in the display window.
-
getAllowedEnumeration()
- Get an enumeration over the list of the nodes allowed
in the area
-
getAllowedLocation(Node)
- Get the location of a node that is allowed in the area.
-
getAllowedLocation(String)
- Get the location of a node that is allowed in the area.
-
getConfig()
- Get the area's configuration.
-
getHeight()
- Get the relative height of the area.
-
getIcon()
- Get the area's screen icon.
-
getLoc()
- Get the area's relative location.
-
getName()
- Get the area's name.
-
getNodeEnumeration()
- Get an enumeration over the members of the area.
-
getNodeLoc(Rectangle, Rectangle)
- Find the relative location of a node within an area.
-
getWidth()
- Get the relative width of the area.
-
getX()
- Get the relative X coordinate of the upper left corner of
the area.
-
getY()
- Get the relative Y coordinate of the upper left corner of
the area.
-
isAllowed(Node)
- Check whether a given node is allowed in the area.
-
isAllowed(String)
- Check whether a given node is allowed in the area.
-
isSelected()
- Check whether the area is selected.
-
isValidName(String)
- Determine whether a string represents a valid area name.
-
isVisible()
- Check whether the are is visible on the display.
-
positionAreaAuto(ViewSettings)
- Dynamically select positions for the nodes in the area.
-
positionAreaByConfig()
- Set positions for the nodes in the area based on their
configured positions.
-
positionSwitchHosts(Switch, double, double)
- Set display locations for all the hosts attached to a
given switch.
-
remove(Node)
- Remove a member node from the area.
-
removeAllMembers()
- Remove all member nodes from the area.
-
removeAllowedNode(Node)
- Remove a node from the list of nodes that are allowed to
be members of the area.
-
removeAllowedNode(String)
- Remove a node from the list of nodes that are allowed to
be members of the area.
-
reposition(ViewSettings)
- Select display locations for the switches and hosts in the area.
-
setAllowedLocation(Node, PointDouble)
- Set the location for a node that is allowed in the area.
-
setAllowedLocation(String, PointDouble)
- Set the location for a node that is allowed in the area.
-
setConfig(VisiConfig)
- Set the area's configuration.
-
setHeight(double)
- Set the relative height of the area.
-
setIcon(Rectangle)
- Set area's screen icon.
-
setLoc(PointDouble)
- Set the area's relative location
-
setName(String)
- Set the area's name.
-
setSelected(boolean)
- Set the area's selection status.
-
setVisible(boolean)
- Set whether the are is visible on the display.
-
setWidth(double)
- Set the relative width of the area.
-
setX(double)
- Set the relative X coordinate of the upper left corner of
the area.
-
setY(double)
- Set the relative Y coordinate of the upper left corner of
the area.
-
toString()
- Get a string describing the area
-
whichEdge(Point)
- Find which edge of a selected area, if any, the cursor is on.
NOT_ALLOWED
public static final int NOT_ALLOWED
- A node is not allowed in an area.
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).
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).
ALLOWED
public static final int ALLOWED
- A node is explicitly allowed in an area.
HASH_TABLE_SIZE
private static final int HASH_TABLE_SIZE
config
private VisiConfig config
- The configuration the area is part of.
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.
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.
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.
name
private String name
- The name of the area. "Default" and "~~Default" have special
meanings, otherwise the name is not significant.
DEFAULT
public static final String DEFAULT
PROG_DEFAULT
public static final String PROG_DEFAULT
visible
private boolean visible
- A flag indicating whether the area is visible.
nodes
private Vector nodes
- A list of the nodes that are members of the area. Each entry
is a Node (Switch or Endsystem) object.
allowedNodes
private Hashtable allowedNodes
- A list of names of the nodes that are allowed in the area.
Each entry is an AreaMember object.
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.
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.
SEL_SQ_SIZE
private static final int SEL_SQ_SIZE
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.
Area
public Area(Area area)
- Constructs an area by copying another area.
- Parameters:
- eter - a the area to be copied.
Area
public Area()
- Constructs an area with default settings.
add
public void add(Node node)
- Add a node to the area.
- Parameters:
- node - the node to be added to the area.
remove
public void remove(Node node)
- Remove a member node from the area.
- Parameters:
- node - the node to be removed.
removeAllMembers
public void removeAllMembers()
- Remove all member nodes from the area.
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.
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.
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.
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.
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.
clearAllowedNodes
public void clearAllowedNodes()
- Clears the list of allowed nodes.
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.
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.
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.
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.
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.
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.
countSwitches
public int countSwitches()
- Count the switches in the area.
- Returns:
- the number of switches that are members of the area.
reposition
public void reposition(ViewSettings view)
- Select display locations for the switches and hosts in the area.
- Parameters:
- view - the view settings in effect
positionAreaAuto
private void positionAreaAuto(ViewSettings view)
- Dynamically select positions for the nodes in the area.
- Parameters:
- view - the view settings in effect
positionAreaByConfig
private void positionAreaByConfig()
- Set positions for the nodes in the area based on their
configured positions.
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.
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.
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.
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.
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.
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.
getConfig
public VisiConfig getConfig()
- Get the area's configuration.
- Returns:
- the configuration the area is in.
setConfig
public void setConfig(VisiConfig config)
- Set the area's configuration.
- Parameters:
- config - the configuration the area is in.
getName
public String getName()
- Get the area's name.
- Returns:
- a string containing the area's name.
setName
public void setName(String n)
- Set the area's name.
- Parameters:
- n - the name for the area.
isVisible
public boolean isVisible()
- Check whether the are is visible on the display.
- Returns:
- true if the area is visible; false otherwise.
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.
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
setLoc
public void setLoc(PointDouble loc)
- Set the area's relative location
- Parameters:
- loc - the new location.
- See Also:
- loc
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
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
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
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
getWidth
public double getWidth()
- Get the relative width of the area.
- Returns:
- a double with the relative width of the area.
- See Also:
- width
setWidth
public void setWidth(double width)
- Set the relative width of the area.
- Parameters:
- width - the relative width of the area.
- See Also:
- width
getHeight
public double getHeight()
- Get the relative height of the area.
- Returns:
- a double with the relative height of the area.
- See Also:
- height
setHeight
public void setHeight(double height)
- Set the relative height of the area.
- Parameters:
- height - the relative height of the area.
- See Also:
- height
getIcon
public Rectangle getIcon()
- Get the area's screen icon.
- Returns:
- a Rectangle that specifies the area's appearance in
the display window.
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.
createIcon
private void createIcon(ViewSettings view)
- Create and save the display icon for the area.
- Parameters:
- view - the view settings for the display.
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.
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.
isSelected
public boolean isSelected()
- Check whether the area is selected.
- Returns:
- true if the area is selected; false otherwise.
setSelected
public void setSelected(boolean b)
- Set the area's selection status.
- Parameters:
- b - a boolean indicating whether the area is now
selected.
toString
public String toString()
- Get a string describing the area
- Returns:
- a string describing the area object.
- Overrides:
- toString in class Object