Package horizons :: Package world :: Package units :: Package collectors :: Module collector :: Class JobList
[hide private]
[frames] | no frames]

Class JobList

source code

object --+    
         |    
      list --+
             |
            JobList

Data structure for evaluating best jobs. It's a list extended by special sort functions.

Instance Methods [hide private]
new empty list
__init__(self, collector, job_order)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
sort_jobs(self)
Call this to sort jobs.
source code
 
_sort_jobs_random(self)
Sorts jobs randomly
source code
 
_sort_jobs_amount(self)
Sorts the jobs by the amount of resources available
source code
 
_sort_jobs_fewest_available(self, shuffle_first=True)
Prefer jobs where least amount is available in obj's inventory.
source code
 
_sort_jobs_fewest_available_and_distance(self)
Sort jobs by distance, but secondarily also consider fewest available resources
source code
 
_sort_jobs_for_storage_collector(self)
Special sophisticated sorting routing for storage collectors.
source code
 
_sort_jobs_distance(self)
Prefer targets that are nearer
source code
 
_sort_target_inventory_full(self)
Prefer targets with full inventory
source code
 
__str__(self)
str(x)
source code

Inherited from list: __add__, __contains__, __delitem__, __delslice__, __eq__, __ge__, __getattribute__, __getitem__, __getslice__, __gt__, __iadd__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __repr__, __reversed__, __rmul__, __setitem__, __setslice__, __sizeof__, append, count, extend, index, insert, pop, remove, reverse, sort

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Class Variables [hide private]
  order_by = Enum('rating', 'amount', 'random', 'fewest_availabl...

Inherited from list: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, collector, job_order)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • collector - collector instance
  • job_order - instance of order_by-Enum
Returns: new empty list
Overrides: object.__init__

sort_jobs(self)

source code 

Call this to sort jobs.

The function to call is decided in `__init__`.

_sort_jobs_fewest_available(self, shuffle_first=True)

source code 

Prefer jobs where least amount is available in obj's inventory. Only considers resource of resource list with minimum amount available. This is supposed to fix urgent shortages.

_sort_jobs_for_storage_collector(self)

source code 

Special sophisticated sorting routing for storage collectors. Same as fewest_available_and_distance_, but also considers whether target inv is full.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

Class Variable Details [hide private]

order_by

Value:
Enum('rating', 'amount', 'random', 'fewest_available', 'fewest_availab\
le_and_distance', 'for_storage_collector', 'distance')