/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ /** * * n-1 * f(n) = sum f1(i) * j=0 */ //-------------------- public class Sum extends Sequence { private long sum; private Sequence s; public Sum(Sequence s) { this.s = s; this.sum = 0; } public long next() { long res = sum; sum += s.next(); return res; } } //--------------------