summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-11-11 22:01:42 +0000
committerPeter Palfrader <peter@palfrader.org>2003-11-11 22:01:42 +0000
commit6a7c8714bb48d626bfe507e8e03225b014fa4dd6 (patch)
tree184da10db067db41387db133022a7bb0e71e22f5
parent04683077fbd54d72e5d96658e04a26300323c714 (diff)
Simplify path building.
-rw-r--r--src/org/noreply/fancydress/type3/PathSpec.java16
1 files 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<serverlists.length; i++) {
- serverlists[i] = concatComponents( randomExitHop, exitHop );
+ serverlists[i] = concatComponents( exitHop );
if (serverlists[i].servers.length < 2)
throw new Mix3PathProblemException("Path too short.");
}