From 2f848cd91f899fe3de2701085ee720b96ba317c0 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 12 Oct 2003 03:24:56 +0000 Subject: Allow passing a path to the Path class constructor. --- src/org/noreply/fancydress/type3/Path.java | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'src/org/noreply/fancydress/type3/Path.java') diff --git a/src/org/noreply/fancydress/type3/Path.java b/src/org/noreply/fancydress/type3/Path.java index af0a6f3..8f492ec 100644 --- a/src/org/noreply/fancydress/type3/Path.java +++ b/src/org/noreply/fancydress/type3/Path.java @@ -2,6 +2,7 @@ package org.noreply.fancydress.type3; import org.noreply.fancydress.crypto.*; +import org.noreply.fancydress.status.*; import org.noreply.fancydress.directory.*; import org.noreply.fancydress.misc.Util; import org.noreply.fancydress.type3.routing.*; @@ -11,23 +12,13 @@ public class Path { HalfPath first; HalfPath second; - public Path(Directory dir) throws Exception { - Hop[] hops1 = new Hop[4]; - Hop[] hops2 = new Hop[2]; + public Path(Directory dir, String path) throws Exception { + int crossover = path.indexOf(':'); + if (crossover < 0) + throw new Mix3Exception("Path is not a valid path: no crossover point specified."); - Server test = dir.getServer("test1"); - ServerDescriptor desc = test.getDescriptor(); - - Routing route1 = new RoutingIP4(InetAddress.getByName("172.22.118.2"), 48099, test.getKeyID()); - hops1[0] = new Hop(route1, desc.getPacketKey()); - hops1[1] = new Hop(route1, desc.getPacketKey()); - hops1[2] = new Hop(route1, desc.getPacketKey()); - hops1[3] = new Hop(route1, desc.getPacketKey()); - hops2[0] = new Hop(route1, desc.getPacketKey()); - hops2[1] = new Hop(route1, desc.getPacketKey()); - - first = new HalfPath(hops1); - second = new HalfPath(hops2); + first = new HalfPath(dir, path.substring(0, crossover)); + second = new HalfPath(dir, path.substring(crossover+1)); } public HalfPath getFirstHalf() { -- cgit v1.2.3