From 6a7c8714bb48d626bfe507e8e03225b014fa4dd6 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 11 Nov 2003 22:01:42 +0000 Subject: Simplify path building. --- src/org/noreply/fancydress/type3/PathSpec.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/org/noreply/fancydress/type3/PathSpec.java b/src/org/noreply/fancydress/type3/PathSpec.java index a0e5d47..07c24da 100644 --- a/src/org/noreply/fancydress/type3/PathSpec.java +++ b/src/org/noreply/fancydress/type3/PathSpec.java @@ -269,11 +269,12 @@ public class PathSpec { /** * Concat path components, getting random amount of hops where requested. * - * @param chopOffRandomLast remove the last component if it is a RandomHop Component. // FIXME: understand what the spec says - * @param exitHop the exit hop to use. + * @param exitHop the exit hop to use, if one was chosen (not needed + * for client site fragmentation assembly). If none + * was chosen, pass null. * @return a list of servers and a crossover point as an ServerlistWithCrossover object. */ - private ServerlistWithCrossover concatComponents(boolean chopOffRandomLast, Server exitHop) throws Mix3PathProblemException { + private ServerlistWithCrossover concatComponents(Server exitHop) throws Mix3PathProblemException { Server[][] components = new Server[pathComponents.length][]; int length = 0; int crossoverBefore = -1; @@ -296,11 +297,8 @@ public class PathSpec { if (c != length) throw new Error ("Did not fill in length hops ("+c+" vs "+length+")"); - if (chopOffRandomLast && servers[servers.length-1] == null) { - Server[] newServers = new Server[servers.length-1]; - System.arraycopy(servers, 0, newServers, 0, servers.length-1); - servers = newServers; - } + if (exitHop != null) + servers[servers.length-1] = exitHop; ServerlistWithCrossover result = new ServerlistWithCrossover(servers, crossoverBefore); return result; @@ -348,7 +346,7 @@ public class PathSpec { ServerlistWithCrossover[] serverlists = new ServerlistWithCrossover[payload.numPackets()]; for (int i=0; i