- Enclosing class:
- HubWorker
public static interface HubWorker.HubSorter
Interface for classes that generate a traversal order for hubs.
Each instance of this class represents a choice of the traversal
order for a set of hubs. That order is determined by a subclass
of
HubBalancer
.-
Method Summary
Modifier and TypeMethodDescriptionHub[]
getHubs()
Get the hubs for this hub worker, listed in the traversal order for this hub.int
Get the desired initial bicycle count for a worker.Hub[]
Get the the hubs whose bicycle count in the preferred area of the hub is larger than the nominal value for that hub.Hub[]
The the hubs whose bicycle count in the preferred area of the hub is lower than the nominal value for that hub.void
sort()
Put the hubs associated with this object into its traversal order.
-
Method Details
-
sort
void sort()Put the hubs associated with this object into its traversal order. -
getHubs
Hub[] getHubs()Get the hubs for this hub worker, listed in the traversal order for this hub.- Returns:
- the hubs
-
getOverNominal
Hub[] getOverNominal()Get the the hubs whose bicycle count in the preferred area of the hub is larger than the nominal value for that hub.- Returns:
- an array of hubs sorted into traversal order
-
getUnderNominal
Hub[] getUnderNominal()The the hubs whose bicycle count in the preferred area of the hub is lower than the nominal value for that hub.- Returns:
- an array of hubs sorted into traversal order
-
getInitialCountEstimate
int getInitialCountEstimate()Get the desired initial bicycle count for a worker. This is the number of bicycles given the state of hubs being serviced that would result in the worker having zero bicycles left at the end of a traversal, ignoring capacity limits for the worker. This is really an estimate as the hubs may change before the worker arrives. The value returned can be negative, which indicates that there are more than the expected number of bicycles at the hubs.- Returns:
- the desired initial bicycle count
-