|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.pzgui.AbstractDrawable
org.openflow.gui.drawables.Link
public class Link
Information about a link.
| Nested Class Summary | |
|---|---|
static class |
Link.LinkExistsException
This exception is thrown if a link which already exists is tried to be re-created. |
| Field Summary | |
|---|---|
static int |
ARROW_HEAD_SIZE
size of the arrow head |
static float |
DEFAULT_PORT_NUM_ALPHA
alpha channel of port numbers |
static boolean |
DRAW_PORT_NUMBERS
whether to draw port numbers each link is attached to |
protected NodeWithPorts |
dst
the destination of this link |
protected short |
dstPort
the port to which this link connects on the destination node |
static java.awt.BasicStroke |
LINE_DEFAULT_STROKE
how the draw a link |
static int |
LINE_WIDTH
thickness of a link |
static int |
NUM_USAGE_COLORS
how finely to precompute usage colors (larger => more memory and more preceise) |
static java.awt.Font |
PORT_NUMBERS_FONT
port number font |
static int |
PORT_NUMBERS_OFFSET
distance from the edge of an object to draw port numbers, if enabled |
protected NodeWithPorts |
src
the source of this link |
protected short |
srcPort
the port to which this link connects on the source node |
static java.awt.Color |
TUNNEL_PAINT_DARK
dark tunnel color |
static java.awt.Color |
TUNNEL_PAINT_LIGHT
light tunnel color |
protected LinkType |
type
the type of this link |
static java.awt.Color |
USAGE_COLOR_0
how to color the link when it is completely unutilized |
static java.awt.Color |
USAGE_COLOR_NEG
how to color the link when it is negatively utilized (probably a special signal or error) |
static java.awt.Color[] |
USAGE_COLORS
array of precomputed usage colors |
static java.awt.image.BufferedImage |
USAGE_LEGEND
image containing the legend of usage colors from low to high utilization |
static int |
WIRELESS_ARC_DEGREES
how many degrees the arc covers |
static int |
WIRELESS_ARC_SIZE
bounding square around the arc |
static int |
WIRELESS_ARCS_SPACE_BETWEEN
amount of space between arcs |
static java.awt.BasicStroke |
WIRELESS_LINE_DEFAULT_STROKE
how to draw the line for wireless links |
| Constructor Summary | |
|---|---|
Link(LinkType linkType,
NodeWithPorts dst,
short dstPort,
NodeWithPorts src,
short srcPort)
Constructs a new link between src and dst. |
|
| Method Summary | |
|---|---|
boolean |
contains(int x,
int y)
Whether these x, y coordinates fall are contained by the object |
void |
disconnect(BackendConnection conn)
Disconnects this link from its attached ports and stops tracking all statistics associated with this link. |
protected void |
drawFailed(java.awt.Graphics2D gfx)
draw an "X" over the node to indicate failure |
void |
drawObject(java.awt.Graphics2D gfx)
Draws the link |
void |
drawOutline(java.awt.Graphics2D gfx,
java.awt.Paint outlineColor,
double ratio)
Draw an outline around the link. |
void |
drawPortNumbers(java.awt.Graphics2D gfx,
float alpha)
draws port numbers by the link drawing's endpoints with the specified alpha |
void |
drawTunnel(java.awt.Graphics2D gfx,
int linkWidth)
draws a tunnel in the area used by the middle of the link |
void |
drawWiredLink(java.awt.Graphics2D gfx)
draws the link as a wired link between endpoints |
void |
drawWirelessLink(java.awt.Graphics2D gfx)
draws the link as a wireless link between endpoints |
boolean |
equals(java.lang.Object o)
|
static java.awt.geom.GeneralPath |
getArrowHead(int sz,
int x1,
int y1,
int x2,
int y2)
Gets a path for an arrow head on an arrow drawn from x1,y1 to x2,y2. |
double |
getCurrentDataRate()
Returns the current bandwidth being sent through the link in ps or a value <0 if those stats are not currently being tracked. |
double |
getCurrentUtilization()
Returns the current utilization of the link in the range [0, 1] or -1 if stats are not currently being tracked for this. |
NodeWithPorts |
getDestination()
get the destination of this link |
double |
getMaximumDataRate()
returns the maximum bandwidth which can be sent through the link in bps |
short |
getMyPort(NodeWithPorts p)
Gets the port number associated with the specified endpoint. |
NodeWithPorts |
getOther(NodeWithPorts p)
Given one endpoint of the link, return the other endpoint. |
short |
getOtherPort(NodeWithPorts p)
Gets the port number associated with the endpoint which is not p. |
NodeWithPorts |
getSource()
get the souce of this link |
LinkStats |
getStats(Match m)
Gets the LinkStats associated with the specified Match, if any |
static java.awt.Color |
getUsageColor(float usage)
Gets the color associated with a particular usage value. |
int |
hashCode()
|
boolean |
isFailed()
Returns true if the link has failed. |
boolean |
isWired()
returns true if the link is a wired link |
boolean |
isWireless()
returns true if the link is a wireless link |
void |
setColorBasedOnCurrentUtilization()
sets the color this link will be drawn based on the current utilization |
void |
setFailed(boolean b)
Sets whether the link has failed. |
LinkType |
setLinkLink()
gets the type of this link |
void |
setLinkLink(LinkType type)
sets the type of this link |
void |
setMaximumDataRate(double bps)
sets the maximum bandwidth which can be sent through the link in bps |
void |
stopTrackingAllStats(BackendConnection conn)
Stop tracking and clear all statistics associated with this link. |
void |
stopTrackingStats(Match m,
BackendConnection conn)
Tells the link to stop tracking stats for the specified Match m. |
java.lang.String |
toString()
|
void |
trackStats(int pollInterval_msec,
Match m,
BackendConnection conn)
Tells the link to acquire the specified stats. |
LinkStats |
trackStats(Match m)
Tells the link to setup stats for specified Match but do not acquire them automatically. |
void |
trackStats(Match m,
BackendConnection conn)
Tells the link to acquire the specified stats (once). |
LinkStats |
trackStats(Match m,
int xid,
boolean isPolling)
Tells the link to setup stats for specified Match but do not acquire them automatically. |
void |
updateStats(Match m,
AggregateStatsReply reply)
update this links with the latest stats reply about this link |
| Methods inherited from class org.pzgui.AbstractDrawable |
|---|
drag, drawBeforeObject, isDrawn, isHovered, isSelected, setHovered, setSelected, unsetDrawn |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static java.awt.Color USAGE_COLOR_NEG
public static java.awt.Color USAGE_COLOR_0
protected LinkType type
protected NodeWithPorts src
protected short srcPort
protected NodeWithPorts dst
protected short dstPort
public static final int LINE_WIDTH
public static final java.awt.BasicStroke LINE_DEFAULT_STROKE
public static final int ARROW_HEAD_SIZE
public static final int WIRELESS_ARC_SIZE
public static final int WIRELESS_ARCS_SPACE_BETWEEN
public static final int WIRELESS_ARC_DEGREES
public static final java.awt.BasicStroke WIRELESS_LINE_DEFAULT_STROKE
public static boolean DRAW_PORT_NUMBERS
public static final int PORT_NUMBERS_OFFSET
public static float DEFAULT_PORT_NUM_ALPHA
public static final java.awt.Font PORT_NUMBERS_FONT
public static final java.awt.Color TUNNEL_PAINT_DARK
public static final java.awt.Color TUNNEL_PAINT_LIGHT
public static final int NUM_USAGE_COLORS
public static final java.awt.Color[] USAGE_COLORS
public static final java.awt.image.BufferedImage USAGE_LEGEND
| Constructor Detail |
|---|
public Link(LinkType linkType,
NodeWithPorts dst,
short dstPort,
NodeWithPorts src,
short srcPort)
throws Link.LinkExistsException
linkType - the type of this linkdst - the destination of this linkdstPort - the destination port of the link (on dst)src - the source node of data on this linksrcPort - the source port of the link (on src)
Link.LinkExistsException - thrown if the link already exists| Method Detail |
|---|
public void disconnect(BackendConnection conn)
throws java.io.IOException
java.io.IOExceptionpublic NodeWithPorts getSource()
getSource in interface Edge<NodeWithPorts>public NodeWithPorts getDestination()
getDestination in interface Edge<NodeWithPorts>public NodeWithPorts getOther(NodeWithPorts p)
getOther in interface Edge<NodeWithPorts>public short getMyPort(NodeWithPorts p)
public short getOtherPort(NodeWithPorts p)
public boolean isWired()
public boolean isWireless()
public LinkType setLinkLink()
public void setLinkLink(LinkType type)
public double getMaximumDataRate()
public void setMaximumDataRate(double bps)
public boolean isFailed()
public void setFailed(boolean b)
public void drawObject(java.awt.Graphics2D gfx)
drawObject in interface DrawabledrawObject in class AbstractDrawableprotected void drawFailed(java.awt.Graphics2D gfx)
public void drawOutline(java.awt.Graphics2D gfx,
java.awt.Paint outlineColor,
double ratio)
gfx - where to drawoutlineColor - color of the outlineratio - how big to make the outline (relative to the
bounding box of this link)
public void drawPortNumbers(java.awt.Graphics2D gfx,
float alpha)
public void drawWiredLink(java.awt.Graphics2D gfx)
public static java.awt.geom.GeneralPath getArrowHead(int sz,
int x1,
int y1,
int x2,
int y2)
sz - Size of the arrow headx1 - initial x coordinatey1 - initial y coordinatex2 - final x coordinatey2 - final y coordinate
public void drawWirelessLink(java.awt.Graphics2D gfx)
public void drawTunnel(java.awt.Graphics2D gfx,
int linkWidth)
public LinkStats getStats(Match m)
public void trackStats(Match m,
BackendConnection conn)
throws java.io.IOException
m - what statistics to getconn - connection to talk to the backend over
java.io.IOException - thrown if the connection fails
public void trackStats(int pollInterval_msec,
Match m,
BackendConnection conn)
throws java.io.IOException
pollInterval_msec - how often to refresh the stats (0 = only once)m - what statistics to getconn - connection to talk to the backend over
java.io.IOException - thrown if the connection failspublic LinkStats trackStats(Match m)
m - the match to setup stats for
public LinkStats trackStats(Match m,
int xid,
boolean isPolling)
m - the match to setup stats forxid - the xid of the request which is acquiring stats for misPolling - whether the stats are being polled with xid
public void stopTrackingStats(Match m,
BackendConnection conn)
throws java.io.IOException
m - the match to stop collecting statistics forconn - the connection over which to tell the backend to stop polling
java.io.IOException - thrown if the connection fails
public void stopTrackingAllStats(BackendConnection conn)
throws java.io.IOException
conn - the connection to send POLL_STOP messages over
java.io.IOException - thrown if the connection fails
public void updateStats(Match m,
AggregateStatsReply reply)
public double getCurrentDataRate()
public double getCurrentUtilization()
public void setColorBasedOnCurrentUtilization()
public static java.awt.Color getUsageColor(float usage)
public boolean contains(int x,
int y)
Drawable
contains in interface Drawablecontains in class AbstractDrawablepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||