@@ -0,0 +1,787 @@
+package nom.bdezonia.zorbage.algorithm;%0A%0Aimport nom.bdezonia.zorbage.type.algebra.Algebra;%0Aimport nom.bdezonia.zorbage.type.algebra.Ordered;%0Aimport nom.bdezonia.zorbage.type.storage.datasource.IndexedDataSource;%0A%0A/**%0A * %0A * @author Barry DeZonia%0A *%0A */%0Apublic class IsSortedUntil %7B%0A%0A%09/**%0A%09 * %0A%09 * @param alg%0A%09 * @param storage%0A%09 * @return%0A%09 */%0A%09public static %3CT extends Algebra%3CT,U%3E & Ordered%3CU%3E,U%3E%0A%09%09long compute(T alg, IndexedDataSource%3CU%3E storage)%0A%09%7B%0A%09%09U tmp1 = alg.construct();%0A%09%09U tmp2 = alg.construct();%0A%09%09long first = 0;%0A%09%09long last = storage.size();%0A%09%09if (first==last) return first;%0A%09%09long next = first;%0A%09%09while (++next != last) %7B%0A%09%09%09storage.get(next, tmp1);%0A%09%09%09storage.get(first, tmp2);%0A%09%09%09if (alg.isLess().call(tmp1, tmp2))%0A%09%09%09%09return next;%0A%09%09%09first++;%0A%09%09%7D%0A%09%09return last;%0A%09%7D%0A%7D%0A

Implement an IsSortedUntil algorithm