System.out.println("setting length to " + (l.getLength().getLength() - (d.getLength() - distance)));
    public byte getDirectionAtDistance(Point p, int distance) {	PathLength d = new PathLength();	ListIterator li = segments.listIterator(0);	while (li.hasNext()) {	    IntLine l = (IntLine) li.next();	    d.add(l.getLength());	    if (d.getLength() >= distance) {		PathLength pl = new PathLength(l.getLength());		System.out.println("setting length to " +			(l.getLength().getLength() -			    (d.getLength() - distance)));		pl.setLength(l.getLength().getLength() - (d.getLength() -			    distance));		IntLine il = new IntLine(l);		il.setLength(pl);		// locus is within this segment.		p.x = il.x2;		p.y = il.y2;		return l.getDirection();	    }	}	// distance was bigger than length of the TrainPath	throw new IllegalArgumentException();    }