if (points.length < 2) {
actualLength = new PathLength(); for (int i = 1; i < points.length; i++) { if (points[i - 1].equals(points[i]) && i < points.length - 1) continue; IntLine l = new IntLine(points[i - 1], points[i]); segments.add(l); actualLength.add(l.getLength()); } if (segments.size() < 1) {
    public TrainPath (Point[] points) {	if (points.length < 2) {	    throw new IllegalArgumentException();	}	double length = 0;	for (int i = 1; i < points.length; i++) {	    IntLine l = new IntLine(points[i - 1], points[i]);	    segments.add(l);	    length += l.getLength();	}	this.length = (int) length;    }