Updatable node class. More...
#include <linkgraph.h>
Public Member Functions | |
Node (LinkGraph *lg, NodeID node) | |
Constructor. | |
Edge | operator[] (NodeID to) |
Get an Edge. | |
EdgeIterator | Begin () |
Get an iterator pointing to the start of the edges array. | |
EdgeIterator | End () |
Get an iterator pointing beyond the end of the edges array. | |
void | UpdateSupply (uint supply) |
Update the node's supply and set last_update to the current date. | |
void | SetDemand (uint demand) |
Set the node's demand. | |
void | AddEdge (NodeID to, uint capacity, uint usage=0) |
Fill an edge with values from a link. | |
void | UpdateEdge (NodeID to, uint capacity, uint usage=0) |
Creates an edge if none exists yet or updates an existing edge. | |
void | RemoveEdge (NodeID to) |
Remove an outgoing edge from this node. |
Updatable node class.
The node itself as well as its edges can be modified.
Definition at line 390 of file linkgraph.h.
LinkGraph::Node::Node | ( | LinkGraph * | lg, | |
NodeID | node | |||
) | [inline] |
Constructor.
lg | LinkGraph to get the node from. | |
node | ID of the node. |
Definition at line 397 of file linkgraph.h.
void LinkGraph::Node::AddEdge | ( | NodeID | to, | |
uint | capacity, | |||
uint | usage = 0 | |||
) |
Fill an edge with values from a link.
If usage < capacity set the usage, otherwise set the restricted or unrestricted update timestamp.
to | Destination node of the link. | |
capacity | Capacity of the link. | |
usage | Usage to be added or REFRESH_UNRESTRICTED or REFRESH_RESTRICTED. |
Definition at line 189 of file linkgraph.cpp.
References _date, LinkGraph::BaseEdge::capacity, LinkGraph::NodeWrapper< BaseNode, BaseEdge >::edges, LinkGraph::NodeWrapper< BaseNode, BaseEdge >::index, LinkGraph::BaseEdge::last_restricted_update, LinkGraph::BaseEdge::last_unrestricted_update, LinkGraph::BaseEdge::next_edge, LinkGraph::REFRESH_RESTRICTED, LinkGraph::REFRESH_UNRESTRICTED, and LinkGraph::BaseEdge::usage.
Referenced by UpdateEdge().
EdgeIterator LinkGraph::Node::Begin | ( | ) | [inline] |
Get an iterator pointing to the start of the edges array.
Definition at line 413 of file linkgraph.h.
References LinkGraph::NodeWrapper< BaseNode, BaseEdge >::edges, and LinkGraph::NodeWrapper< BaseNode, BaseEdge >::index.
Referenced by DeleteStaleLinks().
EdgeIterator LinkGraph::Node::End | ( | ) | [inline] |
Get an iterator pointing beyond the end of the edges array.
Definition at line 419 of file linkgraph.h.
References LinkGraph::NodeWrapper< BaseNode, BaseEdge >::edges.
Referenced by DeleteStaleLinks().
Edge LinkGraph::Node::operator[] | ( | NodeID | to | ) | [inline] |
Get an Edge.
This is not a reference as the wrapper objects are not actually persistent.
to | ID of end node of edge. |
Definition at line 407 of file linkgraph.h.
References LinkGraph::NodeWrapper< BaseNode, BaseEdge >::edges.
void LinkGraph::Node::RemoveEdge | ( | NodeID | to | ) |
Remove an outgoing edge from this node.
to | ID of destination node. |
Definition at line 231 of file linkgraph.cpp.
References LinkGraph::BaseEdge::capacity, LinkGraph::NodeWrapper< BaseNode, BaseEdge >::edges, LinkGraph::NodeWrapper< BaseNode, BaseEdge >::index, INVALID_DATE, LinkGraph::BaseEdge::last_restricted_update, LinkGraph::BaseEdge::last_unrestricted_update, LinkGraph::BaseEdge::next_edge, and LinkGraph::BaseEdge::usage.
Referenced by DeleteStaleLinks().
void LinkGraph::Node::SetDemand | ( | uint | demand | ) | [inline] |
Set the node's demand.
demand | New demand for the node. |
Definition at line 435 of file linkgraph.h.
References LinkGraph::BaseNode::demand, and LinkGraph::NodeWrapper< BaseNode, BaseEdge >::node.
void LinkGraph::Node::UpdateEdge | ( | NodeID | to, | |
uint | capacity, | |||
uint | usage = 0 | |||
) |
Creates an edge if none exists yet or updates an existing edge.
to | Target node. | |
capacity | Capacity of the link. | |
usage | Usage to be added or REFRESH_UNRESTRICTED or REFRESH_RESTRICTED. |
Definition at line 216 of file linkgraph.cpp.
References AddEdge(), LinkGraph::NodeWrapper< BaseNode, BaseEdge >::edges, LinkGraph::REFRESH_RESTRICTED, and LinkGraph::REFRESH_UNRESTRICTED.
void LinkGraph::Node::UpdateSupply | ( | uint | supply | ) | [inline] |
Update the node's supply and set last_update to the current date.
supply | Supply to be added. |
Definition at line 425 of file linkgraph.h.
References _date, LinkGraph::BaseNode::last_update, LinkGraph::NodeWrapper< BaseNode, BaseEdge >::node, and LinkGraph::BaseNode::supply.