org.openflow.gui.drawables
Class NodeWithPorts

java.lang.Object
  extended by org.pzgui.AbstractDrawable
      extended by org.pzgui.layout.AbstractLayoutable
          extended by org.openflow.gui.drawables.Node
              extended by org.openflow.gui.drawables.NodeWithPorts
All Implemented Interfaces:
Drawable, Layoutable, Vertex<Link>
Direct Known Subclasses:
Host, OpenFlowSwitch, SimpleNodeWithPorts

public abstract class NodeWithPorts
extends Node

Information about a node with ports in the topology.

Author:
David Underhill

Field Summary
 
Fields inherited from class org.openflow.gui.drawables.Node
OUTLINE_RATIO, SHOW_NAMES
 
Constructor Summary
NodeWithPorts(NodeType type, java.lang.String name, int x, int y, Icon icon)
           
 
Method Summary
 void drawBeforeObject(java.awt.Graphics2D gfx)
          draws links first
 void drawLinks(java.awt.Graphics2D gfx)
          draws the links associated with this node
 boolean equals(java.lang.Object o)
           
 Link getDirectedLinkTo(short myPort, NodeWithPorts n, short nPort, boolean nIsDestination)
          Returns a link from this node to the requested node if such a link exists
 java.util.Collection<Link> getEdges()
          returns a list of all the links on this node
 Link getLinkFrom(short outPort)
          Gets the link from this node on outPort
 java.util.Collection<Link> getLinks()
          returns a list of all the links on this node
 Link getLinkTo(long dpid)
          Gets a link to a neighboring OpenFlowNode with the specified datapath ID.
 Link getLinkTo(NodeWithPorts n)
          Returns a link from this node to the requested node if such a link exists
 Link getLinkTo(short myPort, NodeWithPorts n, short nPort)
          Returns a link from this node to the requested node if such a link exists
 int getNumLinks()
          Returns the number of links connected to this node.
 NodeType getType()
          gets the type of this node
 int hashCode()
           
 boolean isPortUsed(short portNum)
          Returns whether the specified port is currently connected to a link.
 void unsetDrawn()
          Flag this object as undrawn for the current redraw cycle
 
Methods inherited from class org.openflow.gui.drawables.Node
contains, drawFailed, drawName, drawObject, drawOutline, getDebugName, getHeight, getIcon, getName, getWidth, isFailed, isOff, isWithin, setFailed, setIcon, setName, setOff, toString
 
Methods inherited from class org.pzgui.layout.AbstractLayoutable
canPositionChange, drag, getPos, getX, getY, hasPositionChanged, setCanPositionChange, setPos, setXPos, setYPos, unsetPositionChanged
 
Methods inherited from class org.pzgui.AbstractDrawable
isDrawn, isHovered, isSelected, setHovered, setSelected
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pzgui.Drawable
drag, isDrawn, isHovered, isSelected, setHovered, setSelected
 
Methods inherited from interface org.pzgui.layout.Layoutable
canPositionChange, getID, getPos, getX, getY, hasPositionChanged, setCanPositionChange, setPos, setXPos, setYPos, unsetPositionChanged
 

Constructor Detail

NodeWithPorts

public NodeWithPorts(NodeType type,
                     java.lang.String name,
                     int x,
                     int y,
                     Icon icon)
Method Detail

unsetDrawn

public void unsetDrawn()
Description copied from interface: Drawable
Flag this object as undrawn for the current redraw cycle

Specified by:
unsetDrawn in interface Drawable
Overrides:
unsetDrawn in class AbstractDrawable

drawBeforeObject

public void drawBeforeObject(java.awt.Graphics2D gfx)
draws links first

Specified by:
drawBeforeObject in interface Drawable
Overrides:
drawBeforeObject in class AbstractDrawable

drawLinks

public void drawLinks(java.awt.Graphics2D gfx)
draws the links associated with this node


isPortUsed

public boolean isPortUsed(short portNum)
Returns whether the specified port is currently connected to a link.


getEdges

public java.util.Collection<Link> getEdges()
returns a list of all the links on this node


getLinks

public java.util.Collection<Link> getLinks()
returns a list of all the links on this node


getNumLinks

public int getNumLinks()
Returns the number of links connected to this node.


getLinkFrom

public Link getLinkFrom(short outPort)
Gets the link from this node on outPort


getLinkTo

public Link getLinkTo(NodeWithPorts n)
Returns a link from this node to the requested node if such a link exists


getLinkTo

public Link getLinkTo(short myPort,
                      NodeWithPorts n,
                      short nPort)
Returns a link from this node to the requested node if such a link exists


getDirectedLinkTo

public Link getDirectedLinkTo(short myPort,
                              NodeWithPorts n,
                              short nPort,
                              boolean nIsDestination)
Returns a link from this node to the requested node if such a link exists


getLinkTo

public Link getLinkTo(long dpid)
Gets a link to a neighboring OpenFlowNode with the specified datapath ID.


getType

public NodeType getType()
gets the type of this node


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object