Fixed sliding window for gradient descent

Added operateOnData() method to allow for such things as on-line training and sliding window training (previous implementation worked only for PSO training).