author | truelight |
Sun, 19 Aug 2007 13:16:06 +0000 | |
branch | noai |
changeset 9696 | 4384ed3de1f0 |
parent 9681 | 3997f1ce203a |
child 9752 | bd87e54186f2 |
permissions | -rw-r--r-- |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
2 |
|
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
3 |
/** @file ai_abstractlist.hpp a linked list which can keep item/value pairs */ |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
4 |
|
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
5 |
#ifndef AI_ABSTRACTLIST_HPP |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
6 |
#define AI_ABSTRACTLIST_HPP |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
7 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
8 |
#include "ai_object.hpp" |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
9 |
#include <map> |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
10 |
#include <set> |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
11 |
|
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
12 |
class AIAbstractListSorter; |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
13 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
14 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
15 |
* Class that creates a linked list which can keep item/value pairs. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
16 |
*/ |
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
17 |
class AIAbstractList : public AIObject { |
9665
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
18 |
public: |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
19 |
/** Type of sorter */ |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
20 |
enum SorterType { |
9681
3997f1ce203a
(svn r10630) [NoAI] -Fix: allow enums to not have a predefined value for Squirrel
truelight
parents:
9679
diff
changeset
|
21 |
SORT_BY_VALUE, |
3997f1ce203a
(svn r10630) [NoAI] -Fix: allow enums to not have a predefined value for Squirrel
truelight
parents:
9679
diff
changeset
|
22 |
SORT_BY_ITEM, |
9665
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
23 |
}; |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
24 |
|
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
25 |
private: |
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
26 |
AIAbstractListSorter *sorter; |
9665
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
27 |
SorterType sorter_type; |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
28 |
bool sort_ascending; |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
29 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
30 |
public: |
9590
16cde7f36a88
(svn r9623) [NoAI] -Fix: some comments to make doxygen happy
truelight
parents:
9589
diff
changeset
|
31 |
typedef std::set<int32> AIItemList; ///< The list of items inside the bucket |
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
32 |
typedef std::map<int32, AIItemList> AIAbstractListBucket; ///< The bucket list per value |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
33 |
typedef std::map<int32, int32> AIAbstractListMap; ///< List per item |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
34 |
|
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
35 |
AIAbstractListMap items; ///< The items in the list |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
36 |
AIAbstractListBucket buckets; ///< The items in the list, sorted by value |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
37 |
|
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
38 |
protected: |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
39 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
40 |
* Add a single item to the list. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
41 |
* @param item the item to add. Should be unique, otherwise it is ignored. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
42 |
* @note the value is set to 0 by default. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
43 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
44 |
void AddItem(int32 item); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
45 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
46 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
47 |
* Remove a single item from the list. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
48 |
* @param item the item to remove. If not existing, it is ignored. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
49 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
50 |
void RemoveItem(int32 item); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
51 |
|
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
52 |
public: |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
53 |
/** |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
54 |
* The name of the class, needed by several sub-processes. |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
55 |
*/ |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
56 |
static const char *GetClassName() { return "AIAbstractList"; } |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
57 |
|
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
58 |
/** |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
59 |
* Constructor of the AIAbstractList. |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
60 |
*/ |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
61 |
AIAbstractList(); |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
62 |
|
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
63 |
/** |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
64 |
* Destructor of the AIAbstractList. |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
65 |
*/ |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
66 |
~AIAbstractList(); |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
67 |
|
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
68 |
/** |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
69 |
* Clear the list, making Count() returning 0 and IsEmpty() returning true. |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
70 |
*/ |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
71 |
void Clear(); |
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
72 |
|
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
73 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
74 |
* Check if an item is in the list. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
75 |
* @param item the item to check for. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
76 |
* @return true if the item is in the list. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
77 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
78 |
bool HasItem(int32 item); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
79 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
80 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
81 |
* Go to the beginning of the list. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
82 |
* @return the item value of the first item. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
83 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
84 |
int32 Begin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
85 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
86 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
87 |
* Go to the next item in the list. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
88 |
* @return the item value of the next item. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
89 |
* @note returns 0 if beyond end-of-list. Use HasNext() to check for end-of-list. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
90 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
91 |
int32 Next(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
92 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
93 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
94 |
* Check if a list is empty. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
95 |
* @return true if the list is empty. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
96 |
**/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
97 |
bool IsEmpty(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
98 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
99 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
100 |
* Check if there is a next element. In other words, if this is true, |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
101 |
* Next() will return a valid item. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
102 |
* @return true if there is a next item. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
103 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
104 |
bool HasNext(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
105 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
106 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
107 |
* Returns the amount of items in the list. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
108 |
* @return amount of items in the list. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
109 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
110 |
int32 Count(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
111 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
112 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
113 |
* Get the value that belongs to this item. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
114 |
* @param item the item to get the value from |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
115 |
* @return the value that belongs to this item. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
116 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
117 |
int32 GetValue(int32 item); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
118 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
119 |
/** |
9664
c5741021bf59
(svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents:
9596
diff
changeset
|
120 |
* Set a value of an item directly. |
c5741021bf59
(svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents:
9596
diff
changeset
|
121 |
* @param item the item to set the value for. |
c5741021bf59
(svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents:
9596
diff
changeset
|
122 |
* @param value the value to give to the item |
c5741021bf59
(svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents:
9596
diff
changeset
|
123 |
* @return true if we could set the item to value, false otherwise. |
c5741021bf59
(svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents:
9596
diff
changeset
|
124 |
*/ |
c5741021bf59
(svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents:
9596
diff
changeset
|
125 |
bool SetValue(int32 item, int32 value); |
c5741021bf59
(svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents:
9596
diff
changeset
|
126 |
|
c5741021bf59
(svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents:
9596
diff
changeset
|
127 |
/** |
9665
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
128 |
* Sort this list by the given sorter and direction. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
129 |
* @param sorter the type of sorter to use |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
130 |
* @param ascending if true, lowest value is on top, else at bottom. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
131 |
* @note the current item stays at the same place. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
132 |
*/ |
9665
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
133 |
void Sort(SorterType sorter, bool ascending); |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
134 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
135 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
136 |
* Removes all items with a higher value than 'value'. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
137 |
* @param value the value above which all items are removed. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
138 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
139 |
void RemoveAboveValue(int32 value); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
140 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
141 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
142 |
* Removes all items with a lower value than 'value'. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
143 |
* @param value the value below which all items are removed. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
144 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
145 |
void RemoveBelowValue(int32 value); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
146 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
147 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
148 |
* Removes all items with a value above start and below end. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
149 |
* @param start the lower bound of the to be removed values (exclusive). |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
150 |
* @param end the upper bound of the to be removed valuens (exclusive). |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
151 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
152 |
void RemoveBetweenValue(int32 start, int32 end); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
153 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
154 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
155 |
* Remove all items with this value. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
156 |
* @param value the value to remove. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
157 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
158 |
void RemoveValue(int32 value); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
159 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
160 |
/** |
9665
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
161 |
* Remove the first count items. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
162 |
* @param count the amount of items to remove. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
163 |
*/ |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
164 |
void RemoveTop(int32 count); |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
165 |
|
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
166 |
/** |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
167 |
* Remove the last count items. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
168 |
* @param count the amount of items to remove. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
169 |
*/ |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
170 |
void RemoveBottom(int32 count); |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
171 |
|
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
172 |
/** |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
173 |
* Remove everything that is in the given list from this list (same item index that is). |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
174 |
* @param list the list of items to remove. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
175 |
* @pre list != NULL |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
176 |
*/ |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
177 |
void RemoveList(AIAbstractList *list); |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
178 |
|
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
179 |
/** |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
180 |
* Keep all items with a higher value than 'value'. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
181 |
* @param value the value above which all items are kept. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
182 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
183 |
void KeepAboveValue(int32 value); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
184 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
185 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
186 |
* Keep all items with a lower value than 'value'. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
187 |
* @param value the value below which all items are kept. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
188 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
189 |
void KeepBelowValue(int32 value); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
190 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
191 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
192 |
* Keep all items with a value above start and below end. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
193 |
* @param start the lower bound of the to be kept values (exclusive). |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
194 |
* @param end the upper bound of the to be kept values (exclusive). |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
195 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
196 |
void KeepBetweenValue(int32 start, int32 end); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
197 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
198 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
199 |
* Keep all items with this value. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
200 |
* @param value the value to keep. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
201 |
**/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
202 |
void KeepValue(int32 value); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
203 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
204 |
/** |
9665
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
205 |
* Keep the first count items, i.e. remove everything except the first count items. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
206 |
* @param count the amount of items to keep. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
207 |
*/ |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
208 |
void KeepTop(int32 count); |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
209 |
|
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
210 |
/** |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
211 |
* Keep the last count items, i.e. remove everything except the last count items. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
212 |
* @param count the amount of items to keep. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
213 |
*/ |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
214 |
void KeepBottom(int32 count); |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
215 |
|
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
216 |
/** |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
217 |
* Keps everything that is in the given list from this list (same item index that is). |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
218 |
* @param list the list of items to keep. |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
219 |
* @pre list != NULL |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
220 |
*/ |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
221 |
void KeepList(AIAbstractList *list); |
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
222 |
|
e889ac1e663a
(svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents:
9664
diff
changeset
|
223 |
/** |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
224 |
* The definition how valuators should look. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
225 |
*/ |
9679
788e083db48b
(svn r10625) [NoAI] -Fix: returning C++ classes, by creating a temp SQ class, had its problems, this should fix them all (double-frees, wrong scope, ..)
truelight
parents:
9665
diff
changeset
|
226 |
class Valuator : public AIObject { |
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
227 |
/* Make this valuator a friend of AIAbstractList, so we can access the private. |
9590
16cde7f36a88
(svn r9623) [NoAI] -Fix: some comments to make doxygen happy
truelight
parents:
9589
diff
changeset
|
228 |
* Nobody else should ever call Valuate. */ |
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
229 |
friend class AIAbstractList; |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
230 |
public: |
9590
16cde7f36a88
(svn r9623) [NoAI] -Fix: some comments to make doxygen happy
truelight
parents:
9589
diff
changeset
|
231 |
/** |
16cde7f36a88
(svn r9623) [NoAI] -Fix: some comments to make doxygen happy
truelight
parents:
9589
diff
changeset
|
232 |
* Virtual destructor, needed to make compilers happy. |
16cde7f36a88
(svn r9623) [NoAI] -Fix: some comments to make doxygen happy
truelight
parents:
9589
diff
changeset
|
233 |
*/ |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
234 |
virtual ~Valuator() {} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
235 |
|
9589
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9584
diff
changeset
|
236 |
private: |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9584
diff
changeset
|
237 |
virtual int32 Valuate(int32 item) const = 0; |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
238 |
}; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
239 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
240 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
241 |
* Give all items a value defined by the valuator you give. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
242 |
* @note the valuator should be a valid instance. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
243 |
*/ |
9593
012f29f59906
(svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents:
9590
diff
changeset
|
244 |
void Valuate(const AIAbstractList::Valuator &proc); |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
245 |
}; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
246 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
247 |
#endif /* AI_LIST_HPP */ |