System.out.println("appending " + tp + " to " + this);
    public void append(TrainPath tp) {	System.out.println("appending " + tp + " to " + this);	IntLine tpHead = (IntLine) tp.segments.getFirst();	IntLine tail = (IntLine) segments.getLast();	if (tpHead.x1 != tail.x2 ||		tpHead.y1 != tail.y2)	    throw new IllegalArgumentException();	int headDir = tpHead.getDirection();	if (headDir == 0 || headDir == tail.getDirection()) {	    tail.append(tpHead);	} else {	    segments.add(tpHead);	}	ListIterator i = tp.segments.listIterator(1);	while (i.hasNext()) {	    segments.add(i.next());	}	actualLength.add(tp.actualLength);	length = (int) actualLength.getLength();    }