1 32 package net.sf.retrotranslator.runtime.java.util; 33 34 import edu.emory.mathcs.backport.java.util.Queue; 35 import java.util.*; 36 37 40 public class _Queue { 41 42 public static boolean executeInstanceOfInstruction(Object object) { 43 return object instanceof LinkedList || 44 object instanceof Queue; 45 } 46 47 public static Collection executeCheckCastInstruction(Object object) { 48 if (object instanceof LinkedList) { 49 return (LinkedList) object; 50 } 51 return (Queue) object; 52 } 53 54 public static Object element(Collection collection) { 55 if (collection instanceof LinkedList) { 56 return _LinkedList.element((LinkedList) collection); 57 } 58 return ((Queue) collection).element(); 59 } 60 61 public static boolean offer(Collection collection, Object element) { 62 if (collection instanceof LinkedList) { 63 return _LinkedList.offer((LinkedList) collection, element); 64 } 65 return ((Queue) collection).offer(element); 66 } 67 68 public static Object peek(Collection collection) { 69 if (collection instanceof LinkedList) { 70 return _LinkedList.peek((LinkedList) collection); 71 } 72 return ((Queue) collection).peek(); 73 } 74 75 public static Object poll(Collection collection) { 76 if (collection instanceof LinkedList) { 77 return _LinkedList.poll((LinkedList) collection); 78 } 79 return ((Queue) collection).poll(); 80 } 81 82 public static Object remove(Collection collection) { 83 if (collection instanceof LinkedList) { 84 return _LinkedList.remove((LinkedList) collection); 85 } 86 return ((Queue) collection).remove(); 87 } 88 89 } 90 | Popular Tags |