com.rubecula.darwin.examples.travelingsalesman
Class Route
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.AbstractSequentialList<E>
com.rubecula.darwin.examples.travelingsalesman.CircularLinkedList<Client>
com.rubecula.darwin.examples.travelingsalesman.Route
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Client>, java.util.Collection<Client>, java.util.Deque<Client>, java.util.List<Client>, java.util.Queue<Client>
public class Route
- extends CircularLinkedList<Client>
Class to represent a route between Client
objects. The underlying
representation is of a set of objects arranged in a circular list. Calling
listIterator(int)
gives us a route starting at a particular client
in the list and going around the circular route until we have visited all the
clients.
We can switch any two clients and that operation actually switches the
clients in the underlying list.
- Author:
- Robin Hillyard
- See Also:
- Serialized Form
Fields inherited from class java.util.AbstractList |
modCount |
Methods inherited from class com.rubecula.darwin.examples.travelingsalesman.CircularLinkedList |
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray, toString, usefulModulo |
Methods inherited from class java.util.AbstractSequentialList |
iterator |
Methods inherited from class java.util.AbstractList |
equals, hashCode, listIterator, removeRange, subList |
Methods inherited from class java.util.AbstractCollection |
containsAll, isEmpty, removeAll, retainAll |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Deque |
iterator |
Methods inherited from interface java.util.Collection |
containsAll, equals, hashCode, isEmpty, removeAll, retainAll |
Methods inherited from interface java.util.List |
containsAll, isEmpty, removeAll, retainAll |
createRoute
public static Route createRoute(EcoFactor_Clients clients)
- Parameters:
clients
-
- Returns:
- a newly instantiated Route based on
clients
.
getTravelTime
public double getTravelTime(EcoFactor_TravelTimes factor)
- Parameters:
factor
-
- Returns:
- the travel time for the given factor
listIterator
public java.util.ListIterator<Client> listIterator(int index)
- Description copied from class:
CircularLinkedList
- Returns a list-iterator of the elements in this list (in proper
sequence), starting at the specified position in the list. Obeys the
general contract of List.listIterator(int).
The list-iterator is fail-fast: if the list is structurally
modified at any time after the Iterator is created, in any way except
through the list-iterator's own remove or add methods,
the list-iterator will throw a ConcurrentModificationException.
Thus, in the face of concurrent modification, the iterator fails quickly
and cleanly, rather than risking arbitrary, non-deterministic behavior at
an undetermined time in the future.
- Specified by:
listIterator
in interface java.util.List<Client>
- Overrides:
listIterator
in class CircularLinkedList<Client>
- Parameters:
index
- index of the first element to be returned from the
list-iterator (by a call to next)
- Returns:
- a ListIterator of the elements in this list (in proper sequence),
starting at the specified position in the list
- See Also:
CircularLinkedList.listIterator(int)
swap
public void swap(int index1,
int index2)
- Parameters:
index1
- index2
-
Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.