001package components.sortingmachine; 002 003import java.util.Comparator; 004import java.util.Iterator; 005 006import components.queue.Queue; 007import components.queue.Queue1L; 008 009/** 010 * {@code SortingMachine} represented as a {@link Queue} (using an embedding of 011 * quicksort), with implementations of primary methods. 012 * 013 * @param <T> 014 * type of {@code SortingMachine} entries 015 * @mathdefinitions {@code 016 * IS_TOTAL_PREORDER ( 017 * r: binary relation on T 018 * ) : boolean is 019 * for all x, y, z: T 020 * ((r(x, y) or r(y, x)) and 021 * (if (r(x, y) and r(y, z)) then r(x, z))) 022 * 023 * IS_SORTED ( 024 * s: string of T, 025 * r: binary relation on T 026 * ) : boolean is 027 * for all x, y: T where (<x, y> is substring of s) (r(x, y)) 028 * } 029 * @convention <pre> 030 * IS_TOTAL_PREORDER([relation computed by $this.machineOrder.compare method]) and 031 * if not $this.insertionMode then 032 * IS_SORTED($this.entries, [relation computed by $this.machineOrder.compare method]) 033 * </pre> 034 * @correspondence <pre> 035 * this = 036 * ($this.insertionMode, $this.machineOrder, multiset_entries($this.entries)) 037 * </pre> 038 */ 039public class SortingMachine4<T> extends SortingMachineSecondary<T> { 040 041 /* 042 * 2221/2231 assignment code deleted. 043 */ 044 045}