/** * 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. */ /** * * f(i) = f1(i+1) - f1(i) */ //-------------------- public class Diff extends Sequence { private long last; private Sequence s; public Diff(Sequence s) { this.s = s; this.last = s.next(); } public long next() { long i0 = last; last = s.next(); return last - i0; } } //--------------------