protected class StickMagnetGraph.DefaultNode extends java.lang.Object implements StickMagnetGraph.Node
StickMagnetGraph.Node
Constructor and Description |
---|
DefaultNode(int index,
ScreenDockWindow window)
Creates a new node.
|
Modifier and Type | Method and Description |
---|---|
void |
add(MagnetRequest.Side side,
StickMagnetGraph.DefaultNode depending)
Creates a new edge between
this and depending . |
void |
add(StickMagnetGraph.DefaultEdge edge) |
boolean |
contains(StickMagnetGraph.DefaultNode node)
Checks whether there is an edge from
this node to node . |
void |
doVisit(StickMagnetGraph.Visitor visitor)
Visits this node and all its children, sets the
mark flag. |
StickMagnetGraphConstraint |
getConstraints()
Gets the constraints telling how this node has to be modified.
|
StickMagnetGraph.DefaultEdge[] |
getEdges()
Gets a list of all edges that either start or end at this node.
|
int |
getIndex()
Gets the location of this node in the array of all nodes.
|
MagnetRequest.Side |
getNeighbor(ScreenDockWindow window)
Tells whether
window is a neighbor of this node and
depends on this node, and if so tells on which side of this node
window lies. |
int |
getRootDistance()
Gets the distance of this node to the root node.
|
ScreenDockWindow |
getWindow()
Gest the window which is described by this node.
|
boolean |
isMarked()
Tells whether a flag was set by
StickMagnetGraph.Node.mark() . |
void |
mark()
Marks this node with a flag.
|
void |
unmark()
Unmarks this node from the flag that was set by
StickMagnetGraph.Node.mark() . |
void |
visit(StickMagnetGraph.Visitor visitor)
Visits this node and all its children.
|
public DefaultNode(int index, ScreenDockWindow window)
index
- the location of this node in the array of all nodeswindow
- the window represented by this nodepublic void visit(StickMagnetGraph.Visitor visitor)
StickMagnetGraph.Node
visit
in interface StickMagnetGraph.Node
visitor
- the visitor used to traverse the nodepublic StickMagnetGraphConstraint getConstraints()
getConstraints
in interface StickMagnetGraph.Node
public int getRootDistance()
public void doVisit(StickMagnetGraph.Visitor visitor)
mark
flag.visitor
- the visitor that is calledpublic void mark()
StickMagnetGraph.Node
mark
in interface StickMagnetGraph.Node
public boolean isMarked()
StickMagnetGraph.Node
StickMagnetGraph.Node.mark()
.isMarked
in interface StickMagnetGraph.Node
public void unmark()
StickMagnetGraph.Node
StickMagnetGraph.Node.mark()
.unmark
in interface StickMagnetGraph.Node
public ScreenDockWindow getWindow()
StickMagnetGraph.Node
getWindow
in interface StickMagnetGraph.Node
public int getIndex()
public void add(MagnetRequest.Side side, StickMagnetGraph.DefaultNode depending)
this
and depending
. If there is already
an edge from either node to the other, then nothing happens.side
- the side at which depending
liesdepending
- the node to which a new edge may be createdpublic void add(StickMagnetGraph.DefaultEdge edge)
public boolean contains(StickMagnetGraph.DefaultNode node)
this
node to node
.node
- the node to searchtrue
if there is a directed edgepublic MagnetRequest.Side getNeighbor(ScreenDockWindow window)
StickMagnetGraph.Node
window
is a neighbor of this node and
depends on this node, and if so tells on which side of this node
window
lies.getNeighbor
in interface StickMagnetGraph.Node
window
- a window that might be a neighbor of this nodewindow
lies or null
public StickMagnetGraph.DefaultEdge[] getEdges()
StickMagnetGraph.Node
getEdges
in interface StickMagnetGraph.Node