| ... | ... |
@@ -29,3 +29,4 @@ |
| 29 | 29 |
|
| 30 |
#include < |
|
| 30 |
#include <lemon/bits/traits.h> |
|
| 31 |
|
|
| 31 | 32 |
namespace lemon {
|
| ... | ... |
@@ -46,5 +47,5 @@ |
| 46 | 47 |
/// |
| 47 |
///\param Graph the underlying graph |
|
| 48 |
///\param Graph Type of the underlying graph. |
|
| 48 | 49 |
///\param Item Type of the items the data is assigned to (Graph::Node, |
| 49 |
///Graph:: |
|
| 50 |
///Graph::Arc, Graph::Edge). |
|
| 50 | 51 |
template<class Graph, class Item> |
| ... | ... |
@@ -102,11 +103,11 @@ |
| 102 | 103 |
/// |
| 103 |
///\param g The underlying graph |
|
| 104 |
///\param max_level Set the range of the possible labels to |
|
| 105 |
///[0...\c max_level] |
|
| 106 |
Elevator(const Graph &g,int max_level) : |
|
| 107 |
|
|
| 104 |
///\param graph The underlying graph. |
|
| 105 |
///\param max_level The maximum allowed level. |
|
| 106 |
///Set the range of the possible labels to <tt>[0..max_level]</tt>. |
|
| 107 |
Elevator(const Graph &graph,int max_level) : |
|
| 108 |
_g(graph), |
|
| 108 | 109 |
_max_level(max_level), |
| 109 | 110 |
_item_num(_max_level), |
| 110 |
_where(g), |
|
| 111 |
_level(g,0), |
|
| 111 |
_where(graph), |
|
| 112 |
_level(graph,0), |
|
| 112 | 113 |
_items(_max_level), |
| ... | ... |
@@ -119,11 +120,11 @@ |
| 119 | 120 |
/// |
| 120 |
///\param g The underlying graph |
|
| 121 |
///The range of the possible labels is [0...\c max_level], |
|
| 121 |
///\param graph The underlying graph. |
|
| 122 |
///Set the range of the possible labels to <tt>[0..max_level]</tt>, |
|
| 122 | 123 |
///where \c max_level is equal to the number of labeled items in the graph. |
| 123 |
Elevator(const Graph &g) : |
|
| 124 |
_g(g), |
|
| 125 |
|
|
| 124 |
Elevator(const Graph &graph) : |
|
| 125 |
_g(graph), |
|
| 126 |
_max_level(countItems<Graph, Item>(graph)), |
|
| 126 | 127 |
_item_num(_max_level), |
| 127 |
_where(g), |
|
| 128 |
_level(g,0), |
|
| 128 |
_where(graph), |
|
| 129 |
_level(graph,0), |
|
| 129 | 130 |
_items(_max_level), |
| ... | ... |
@@ -169,3 +170,3 @@ |
| 169 | 170 |
} |
| 170 |
///Return true if |
|
| 171 |
///Return true if level \c l is empty. |
|
| 171 | 172 |
bool emptyLevel(int l) const |
| ... | ... |
@@ -184,3 +185,3 @@ |
| 184 | 185 |
} |
| 185 |
///Return true if there is |
|
| 186 |
///Return true if there is no active item on level \c l. |
|
| 186 | 187 |
bool activeFree(int l) const |
| ... | ... |
@@ -203,5 +204,3 @@ |
| 203 | 204 |
|
| 204 |
///Return a highest level active item. |
|
| 205 |
/// |
|
| 206 |
/// |
|
| 205 |
///Return a highest level active item or INVALID if there is no active |
|
| 207 | 206 |
///item. |
| ... | ... |
@@ -212,7 +211,5 @@ |
| 212 | 211 |
|
| 213 |
///Return |
|
| 212 |
///Return the highest active level. |
|
| 214 | 213 |
|
| 215 |
///Return a highest active level. |
|
| 216 |
/// |
|
| 217 |
/// |
|
| 214 |
///Return the level of the highest active item or -1 if there is no active |
|
| 218 | 215 |
///item. |
| ... | ... |
@@ -235,3 +232,3 @@ |
| 235 | 232 |
|
| 236 |
///Lift the highest active item. |
|
| 233 |
///Lift the highest active item to the given level. |
|
| 237 | 234 |
|
| ... | ... |
@@ -257,10 +254,6 @@ |
| 257 | 254 |
|
| 258 |
///Lift the highest active item. |
|
| 255 |
///Lift the highest active item to the top level. |
|
| 259 | 256 |
|
| 260 | 257 |
///Lift the item returned by highestActive() to the top level and |
| 261 |
///deactivates it. |
|
| 262 |
/// |
|
| 263 |
///\warning \c new_level must be strictly higher |
|
| 264 |
///than the current level. |
|
| 265 |
/// |
|
| 258 |
///deactivate it. |
|
| 266 | 259 |
void liftHighestActiveToTop() |
| ... | ... |
@@ -291,7 +284,5 @@ |
| 291 | 284 |
|
| 292 |
/// |
|
| 285 |
///Return an active item on level \c l. |
|
| 293 | 286 |
|
| 294 |
///Returns an active item on level \c l. |
|
| 295 |
/// |
|
| 296 |
/// |
|
| 287 |
///Return an active item on level \c l or \ref INVALID if there is no such |
|
| 297 | 288 |
///an item. (\c l must be from the range [0...\c max_level]. |
| ... | ... |
@@ -302,5 +293,5 @@ |
| 302 | 293 |
|
| 303 |
/// |
|
| 294 |
///Lift the active item returned by \c activeOn(level) by one. |
|
| 304 | 295 |
|
| 305 |
/// |
|
| 296 |
///Lift the active item returned by \ref activeOn() "activeOn(level)" |
|
| 306 | 297 |
///by one. |
| ... | ... |
@@ -314,5 +305,5 @@ |
| 314 | 305 |
|
| 315 |
/// |
|
| 306 |
///Lift the active item returned by \c activeOn(level) to the given level. |
|
| 316 | 307 |
|
| 317 |
/// |
|
| 308 |
///Lift the active item returned by \ref activeOn() "activeOn(level)" |
|
| 318 | 309 |
///to the given level. |
| ... | ... |
@@ -333,6 +324,6 @@ |
| 333 | 324 |
|
| 334 |
/// |
|
| 325 |
///Lift the active item returned by \c activeOn(level) to the top level. |
|
| 335 | 326 |
|
| 336 |
///Lifts the active item returned by \c activeOn() member function |
|
| 337 |
///to the top level. |
|
| 327 |
///Lift the active item returned by \ref activeOn() "activeOn(level)" |
|
| 328 |
///to the top level and deactivate it. |
|
| 338 | 329 |
void liftActiveToTop(int level) |
| ... | ... |
@@ -386,5 +377,6 @@ |
| 386 | 377 |
|
| 387 |
///This function moves an inactive item to the top but one level. |
|
| 388 |
///It makes the underlying datastructure corrupt, so use is only if |
|
| 389 |
/// |
|
| 378 |
///This function moves an inactive item from the top level to the top |
|
| 379 |
///but one level (in a dirty way). |
|
| 380 |
///\warning It makes the underlying datastructure corrupt, so use it |
|
| 381 |
///only if you really know what it is for. |
|
| 390 | 382 |
///\pre The item is on the top level. |
| ... | ... |
@@ -394,6 +386,6 @@ |
| 394 | 386 |
|
| 395 |
///Lift all items on and above |
|
| 387 |
///Lift all items on and above the given level to the top level. |
|
| 396 | 388 |
|
| 397 |
///This function lifts all items on and above level \c l to \c |
|
| 398 |
///maxLevel(), and also deactivates them. |
|
| 389 |
///This function lifts all items on and above level \c l to the top |
|
| 390 |
///level and deactivates them. |
|
| 399 | 391 |
void liftToTop(int l) |
| ... | ... |
@@ -422,10 +414,9 @@ |
| 422 | 414 |
///\name Initialization |
| 423 |
///Using |
|
| 415 |
///Using these functions you can initialize the levels of the items. |
|
| 424 | 416 |
///\n |
| 425 |
///This initializatios is started with calling \c initStart(). |
|
| 426 |
///Then the |
|
| 427 |
///items should be listed levels by levels statring with the lowest one |
|
| 428 |
///(with level 0). This is done by using \c initAddItem() |
|
| 429 |
///and \c initNewLevel(). Finally \c initFinish() must be called. |
|
| 430 |
///The items not listed will be put on the highest level. |
|
| 417 |
///The initialization must be started with calling \c initStart(). |
|
| 418 |
///Then the items should be listed level by level starting with the |
|
| 419 |
///lowest one (level 0) using \c initAddItem() and \c initNewLevel(). |
|
| 420 |
///Finally \c initFinish() must be called. |
|
| 421 |
///The items not listed are put on the highest level. |
|
| 431 | 422 |
///@{
|
| ... | ... |
@@ -433,3 +424,2 @@ |
| 433 | 424 |
///Start the initialization process. |
| 434 |
|
|
| 435 | 425 |
void initStart() |
| ... | ... |
@@ -451,3 +441,2 @@ |
| 451 | 441 |
///Add an item to the current level. |
| 452 |
|
|
| 453 | 442 |
void initAddItem(Item i) |
| ... | ... |
@@ -471,3 +460,2 @@ |
| 471 | 460 |
///Finalize the initialization process. |
| 472 |
|
|
| 473 | 461 |
void initFinish() |
| ... | ... |
@@ -502,5 +490,5 @@ |
| 502 | 490 |
/// |
| 503 |
///\param Graph the underlying graph |
|
| 491 |
///\param Graph Type of the underlying graph. |
|
| 504 | 492 |
///\param Item Type of the items the data is assigned to (Graph::Node, |
| 505 |
///Graph:: |
|
| 493 |
///Graph::Arc, Graph::Edge). |
|
| 506 | 494 |
template <class Graph, class Item> |
| ... | ... |
@@ -535,5 +523,5 @@ |
| 535 | 523 |
/// |
| 536 |
///\param g The underlying graph |
|
| 537 |
///\param max_level Set the range of the possible labels to |
|
| 538 |
/// |
|
| 524 |
///\param graph The underlying graph. |
|
| 525 |
///\param max_level The maximum allowed level. |
|
| 526 |
///Set the range of the possible labels to <tt>[0..max_level]</tt>. |
|
| 539 | 527 |
LinkedElevator(const Graph& graph, int max_level) |
| ... | ... |
@@ -548,4 +536,4 @@ |
| 548 | 536 |
/// |
| 549 |
///\param g The underlying graph |
|
| 550 |
///The range of the possible labels is [0...\c max_level], |
|
| 537 |
///\param graph The underlying graph. |
|
| 538 |
///Set the range of the possible labels to <tt>[0..max_level]</tt>, |
|
| 551 | 539 |
///where \c max_level is equal to the number of labeled items in the graph. |
| ... | ... |
@@ -659,3 +647,3 @@ |
| 659 | 647 |
|
| 660 |
///Return true if there is |
|
| 648 |
///Return true if there is no active item on level \c l. |
|
| 661 | 649 |
bool activeFree(int l) const {
|
| ... | ... |
@@ -677,6 +665,4 @@ |
| 677 | 665 |
|
| 678 |
///Return a highest level active item. |
|
| 679 |
/// |
|
| 680 |
///\return the highest level active item or INVALID if there is no |
|
| 681 |
///active item. |
|
| 666 |
///Return a highest level active item or INVALID if there is no active |
|
| 667 |
///item. |
|
| 682 | 668 |
Item highestActive() const {
|
| ... | ... |
@@ -685,8 +671,6 @@ |
| 685 | 671 |
|
| 686 |
///Return |
|
| 672 |
///Return the highest active level. |
|
| 687 | 673 |
|
| 688 |
///Return a highest active level. |
|
| 689 |
/// |
|
| 690 |
///\return the level of the highest active item or -1 if there is |
|
| 691 |
///no active item. |
|
| 674 |
///Return the level of the highest active item or -1 if there is no active |
|
| 675 |
///item. |
|
| 692 | 676 |
int highestActiveLevel() const {
|
| ... | ... |
@@ -721,3 +705,3 @@ |
| 721 | 705 |
|
| 722 |
///Lift the highest active item. |
|
| 706 |
///Lift the highest active item to the given level. |
|
| 723 | 707 |
|
| ... | ... |
@@ -749,7 +733,6 @@ |
| 749 | 733 |
|
| 750 |
///Lift the highest active to top. |
|
| 734 |
///Lift the highest active item to the top level. |
|
| 751 | 735 |
|
| 752 | 736 |
///Lift the item returned by highestActive() to the top level and |
| 753 |
///deactivates the item. |
|
| 754 |
/// |
|
| 737 |
///deactivate it. |
|
| 755 | 738 |
void liftHighestActiveToTop() {
|
| ... | ... |
@@ -775,7 +758,5 @@ |
| 775 | 758 |
|
| 776 |
/// |
|
| 759 |
///Return an active item on level \c l. |
|
| 777 | 760 |
|
| 778 |
///Returns an active item on level \c l. |
|
| 779 |
/// |
|
| 780 |
/// |
|
| 761 |
///Return an active item on level \c l or \ref INVALID if there is no such |
|
| 781 | 762 |
///an item. (\c l must be from the range [0...\c max_level]. |
| ... | ... |
@@ -786,5 +767,5 @@ |
| 786 | 767 |
|
| 787 |
/// |
|
| 768 |
///Lift the active item returned by \c activeOn(l) by one. |
|
| 788 | 769 |
|
| 789 |
/// |
|
| 770 |
///Lift the active item returned by \ref activeOn() "activeOn(l)" |
|
| 790 | 771 |
///by one. |
| ... | ... |
@@ -815,6 +796,6 @@ |
| 815 | 796 |
|
| 816 |
/// \brief Lifts the active item returned by \c activeOn() member function. |
|
| 817 |
/// |
|
| 818 |
/// Lifts the active item returned by \c activeOn() member function |
|
| 819 |
/// to the given level. |
|
| 797 |
///Lift the active item returned by \c activeOn(l) to the given level. |
|
| 798 |
|
|
| 799 |
///Lift the active item returned by \ref activeOn() "activeOn(l)" |
|
| 800 |
///to the given level. |
|
| 820 | 801 |
void liftActiveOn(int l, int new_level) |
| ... | ... |
@@ -844,6 +825,6 @@ |
| 844 | 825 |
|
| 845 |
/// |
|
| 826 |
///Lift the active item returned by \c activeOn(l) to the top level. |
|
| 846 | 827 |
|
| 847 |
///Lifts the active item returned by \c activeOn() member function |
|
| 848 |
///to the top level. |
|
| 828 |
///Lift the active item returned by \ref activeOn() "activeOn(l)" |
|
| 829 |
///to the top level and deactivate it. |
|
| 849 | 830 |
void liftActiveToTop(int l) |
| ... | ... |
@@ -902,5 +883,6 @@ |
| 902 | 883 |
|
| 903 |
///This function moves an inactive item to the top but one level. |
|
| 904 |
///It makes the underlying datastructure corrupt, so use is only if |
|
| 905 |
/// |
|
| 884 |
///This function moves an inactive item from the top level to the top |
|
| 885 |
///but one level (in a dirty way). |
|
| 886 |
///\warning It makes the underlying datastructure corrupt, so use it |
|
| 887 |
///only if you really know what it is for. |
|
| 906 | 888 |
///\pre The item is on the top level. |
| ... | ... |
@@ -910,6 +892,6 @@ |
| 910 | 892 |
|
| 911 |
///Lift all items on and above |
|
| 893 |
///Lift all items on and above the given level to the top level. |
|
| 912 | 894 |
|
| 913 |
///This function lifts all items on and above level \c l to \c |
|
| 914 |
///maxLevel(), and also deactivates them. |
|
| 895 |
///This function lifts all items on and above level \c l to the top |
|
| 896 |
///level and deactivates them. |
|
| 915 | 897 |
void liftToTop(int l) {
|
| ... | ... |
@@ -938,10 +920,9 @@ |
| 938 | 920 |
///\name Initialization |
| 939 |
///Using |
|
| 921 |
///Using these functions you can initialize the levels of the items. |
|
| 940 | 922 |
///\n |
| 941 |
///This initializatios is started with calling \c initStart(). |
|
| 942 |
///Then the |
|
| 943 |
///items should be listed levels by levels statring with the lowest one |
|
| 944 |
///(with level 0). This is done by using \c initAddItem() |
|
| 945 |
///and \c initNewLevel(). Finally \c initFinish() must be called. |
|
| 946 |
///The items not listed will be put on the highest level. |
|
| 923 |
///The initialization must be started with calling \c initStart(). |
|
| 924 |
///Then the items should be listed level by level starting with the |
|
| 925 |
///lowest one (level 0) using \c initAddItem() and \c initNewLevel(). |
|
| 926 |
///Finally \c initFinish() must be called. |
|
| 927 |
///The items not listed are put on the highest level. |
|
| 947 | 928 |
///@{
|
| ... | ... |
@@ -949,3 +930,2 @@ |
| 949 | 930 |
///Start the initialization process. |
| 950 |
|
|
| 951 | 931 |
void initStart() {
|
| ... | ... |
@@ -964,3 +944,2 @@ |
| 964 | 944 |
///Add an item to the current level. |
| 965 |
|
|
| 966 | 945 |
void initAddItem(Item i) {
|
| ... | ... |
@@ -989,3 +968,2 @@ |
| 989 | 968 |
///Finalize the initialization process. |
| 990 |
|
|
| 991 | 969 |
void initFinish() {
|
0 comments (0 inline)