Package org.restlet.util
Class RouteList
- java.lang.Object
 - 
- org.restlet.util.WrapperList<Route>
 - 
- org.restlet.util.RouteList
 
 
 
- 
- All Implemented Interfaces:
 java.lang.Iterable<Route>,java.util.Collection<Route>,java.util.List<Route>
public final class RouteList extends WrapperList<Route>
Modifiable list of routes with some helper methods. Note that this class implements theListinterface using the Route class as the generic type. This allows you to use an instance of this class as any otherList, in particular all the helper methods inCollections.
Note that structural changes to this list are thread-safe, using an underlyingCopyOnWriteArrayList.- Author:
 - Jerome Louvel
 - See Also:
 Collections,List
 
- 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RoutegetBest(Request request, Response response, float requiredScore)Returns the best route match for a given call.RoutegetFirst(Request request, Response response, float requiredScore)Returns the first route match for a given call.RoutegetLast(Request request, Response response, float requiredScore)Returns the last route match for a given call.RoutegetNext(Request request, Response response, float requiredScore)Returns a next route match in a round robin mode for a given call.RoutegetRandom(Request request, Response response, float requiredScore)Returns a random route match for a given call.voidremoveAll(Restlet target)Removes all routes routing to a given target.RouteListsubList(int fromIndex, int toIndex)Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.- 
Methods inherited from class org.restlet.util.WrapperList
add, add, addAll, addAll, clear, contains, containsAll, equals, get, getDelegate, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, toArray, toArray, toString 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
RouteList
public RouteList()
Constructor. 
- 
RouteList
public RouteList(java.util.List<Route> delegate)
Constructor.- Parameters:
 delegate- The delegate list.
 
 - 
 
- 
Method Detail
- 
getBest
public Route getBest(Request request, Response response, float requiredScore)
Returns the best route match for a given call.- Parameters:
 request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
 - The best route match or null.
 
 
- 
getFirst
public Route getFirst(Request request, Response response, float requiredScore)
Returns the first route match for a given call.- Parameters:
 request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
 - The first route match or null.
 
 
- 
getLast
public Route getLast(Request request, Response response, float requiredScore)
Returns the last route match for a given call.- Parameters:
 request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
 - The last route match or null.
 
 
- 
getNext
public Route getNext(Request request, Response response, float requiredScore)
Returns a next route match in a round robin mode for a given call.- Parameters:
 request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
 - A next route or null.
 
 
- 
getRandom
public Route getRandom(Request request, Response response, float requiredScore)
Returns a random route match for a given call. Note that the current implementation doesn't uniformly return routes unless they all score above the required score.- Parameters:
 request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
 - A random route or null.
 
 
- 
removeAll
public void removeAll(Restlet target)
Removes all routes routing to a given target.- Parameters:
 target- The target Restlet to detach.
 
- 
subList
public RouteList subList(int fromIndex, int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.- Specified by:
 subListin interfacejava.util.List<Route>- Overrides:
 subListin classWrapperList<Route>- Parameters:
 fromIndex- The start position.toIndex- The end position (exclusive).- Returns:
 - The sub-list.
 
 
 - 
 
 -