@Override
	public void addPoint(double distance, int index) {
		if (distance >= worstDistance)
			return;

		if (count < capacity)
			count++;

		int i;
		for (i = count-1; i > 0; i--) {
			if (distanceIndexArray.get(i-1).distance > distance ||
				(distanceIndexArray.get(i-1).distance == distance && distanceIndexArray.get(i-1).index > index)) {
				distanceIndexArray.set (i, distanceIndexArray.get (i-1));
			} else {
				break;
			}
		}
		distanceIndexArray.set (i, new DistanceIndex (distance, index));

		if (full()) {
			worstDistance = distanceIndexArray.get(capacity-1).distance;
		}
	}