/// <summary> /// Visits (but does not alter) some entries of this vector in default order /// (increasing index). /// </summary> /// <param name="visitor">visitor to be used to process the entries of this vector</param> /// <param name="start">the index of the first entry to be visited</param> /// <param name="end">the index of the last entry to be visited (inclusive)</param> /// <returns>the value returned by <see cref="FieldVectorPreservingVisitor.end()"/> /// at the end of the walk</returns> /// <exception cref="NumberIsTooSmallException"> if <c>end < start</c>.</exception> /// <exception cref="OutOfRangeException"> if the indices are not valid.</exception> public T walkInDefaultOrder(FieldVectorPreservingVisitor <T> visitor, int start, int end) { checkIndices(start, end); visitor.start(getDimension(), start, end); for (int i = start; i <= end; i++) { visitor.visit(i, getEntry(i)); } return(visitor.end()); }
/// <summary> /// Visits (but does not alter) all entries of this vector in default order /// (increasing index). /// </summary> /// <param name="visitor">the visitor to be used to process the entries of this /// vector</param> /// <returns>the value returned by <see cref="FieldVectorPreservingVisitor.end()"/> /// at the end of the walk</returns> public T walkInDefaultOrder(FieldVectorPreservingVisitor <T> visitor) { int dim = getDimension(); visitor.start(dim, 0, dim - 1); for (int i = 0; i < dim; i++) { visitor.visit(i, getEntry(i)); } return(visitor.end()); }