Extract just the code from this (remove line numbers): Page 1 of 2 WaitingLine.java…
- User
Extract just the code from this (remove line numbers):
Page 1 of 2 WaitingLine.java Thursday, April 4, 2024, 11:58 AM 1 package components.waitingline; 2 3 import components.queue.Queue; 4 5 /** 6 * {@code WaitingLineKernel} enhanced with secondary methods. 7 * 8 * @param type of {@code WaitingLineKernel} entries 9 * @mathdefinitions 10 * 11 * 12 * IS_TOTAL_PREORDER ( 13 * r: binary relation on T 14 * ) : boolean is 15 * for all x, y, z: T 16 * ((r(x, y) or r(y, x)) and 17 * (if (r(x, y) and r(y, z)) then r(x, z))) 18 * 19 * IS_SORTED ( 20 * s: string of T, 21 * r: binary relation on T 22 * ) : boolean is 23 * for all x, y: T where (<x, y> is substring of s) (r(x, y)) 24 * 25 * 26 * @author Erich Boschert, Alex Zhang 27 / 28 public interface WaitingLine extends WaitingLineKernel { 29 30 /* 31 * Replaces the front of {@code this} with {@code x}, and returns the old front. 32 * 33 * @param x the new front entry 34 * @return the old front entry 35 * @aliases reference {@code x} 36 * @updates this 37 * @requires this /= <> 38 * @ensures 39 * 40 * 41 * is prefix of #this and 42 * this = * #this[1, |#this|) 43 * 44 / 45 T replaceFront(T x); 46 47 /* 48 * Concatenates ("appends") {@code q} to the end of {@code this}. 49 * 50 * @param q the {@code Queue} to be appended to the end of {@code this} 51 * @updates this 52 * @clears q 53 * @ensures this = #this * #q 54 / 55 void append(Queue q); 56 57 /* 58 * Returns the element at the index of {@code this}. 59 * 60 * @param index the index of the element 61 * @return the element at the provided index 62 / 63 T entry(int index); 64 65 /* 66 * Reverses ("flips") {@code this}. 67 * 68 * @updates this 69 * @ensures this = rev(#this) 70 */ 71 void flip(); 72 Page 1 WaitingLine.java Thursday, April 4, 2024, 11:58 AM 73 } Page 2
- Assistantjava