|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectlogist.topology.Topology
public class Topology
The Topology encapsulates the cities and routes in the Pickup and Delivery problem.
Each Topology.City in the topology has a unique id
field in the range [0, size). This allows to use cities as indices
in array- or list-based data structures, for example:
distance[from.id][to.id]
This class provides the following shortcut to iterate over all cities in the topology:
for (City city : topology) ...
The lists returned by the cities and neighbors methods are read-only and must be copied before they can be modified.
| Nested Class Summary | |
|---|---|
static class |
Topology.Builder
A builder class to facilitate the construction of a topology. |
class |
Topology.City
This class provides the following shortcut to iterate over all neighbors of this city: for (City neighbor : myCity) ... |
| Method Summary | |
|---|---|
java.util.List<Topology.City> |
cities()
Returns the list of all cities in the topology. |
boolean |
contains(Topology.City city)
Checks whether a city is contained by this topology. |
java.util.Iterator<Topology.City> |
iterator()
An iterator over all cities in the topology. |
Topology.City |
parseCity(java.lang.String name)
Find a city by name |
Topology.City |
randomCity(java.util.Random rnd)
Returns a random city in the topology |
int |
size()
the number of cities in the topology |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public java.util.Iterator<Topology.City> iterator()
iterator in interface java.lang.Iterable<Topology.City>public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.List<Topology.City> cities()
The list must be copied before it can be modified.
public int size()
public Topology.City randomCity(java.util.Random rnd)
rnd - a random number generatorpublic boolean contains(Topology.City city)
city - the city to checkpublic Topology.City parseCity(java.lang.String name)
name - The name of the city
java.lang.IllegalArgumentException - if no city with that name exists
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||