1 19 package bak.pcj.list; 20 21 import bak.pcj.util.Exceptions; 22 23 import bak.pcj.DoubleCollection; 24 import bak.pcj.UnmodifiableDoubleCollection; 25 26 35 public class UnmodifiableDoubleList extends UnmodifiableDoubleCollection implements DoubleList { 36 37 49 public UnmodifiableDoubleList(DoubleList l) { 50 super(l); 51 } 52 53 private DoubleList list() 54 { return (DoubleList)collection; } 55 56 62 public void add(int index, double v) 63 { Exceptions.unmodifiable("list"); } 64 65 71 public boolean addAll(int index, DoubleCollection c) 72 { Exceptions.unmodifiable("list"); return false; } 73 74 public double get(int index) 75 { return list().get(index); } 76 77 public int indexOf(double c) 78 { return list().indexOf(c); } 79 80 83 public int indexOf(int index, double c) 84 { return list().indexOf(index, c); } 85 86 public int lastIndexOf(double c) 87 { return list().lastIndexOf(c); } 88 89 92 public int lastIndexOf(int index, double c) 93 { return list().lastIndexOf(index, c); } 94 95 public DoubleListIterator listIterator() 96 { return listIterator(0); } 97 98 public DoubleListIterator listIterator(int index) { 99 final DoubleListIterator i = list().listIterator(index); 100 return new DoubleListIterator() { 101 public boolean hasNext() 102 { return i.hasNext(); } 103 104 public double next() 105 { return i.next(); } 106 107 public void remove() 111 { Exceptions.unmodifiable("list"); } 112 113 public void add(double v) 114 { Exceptions.unmodifiable("list"); } 115 116 public boolean hasPrevious() 117 { return i.hasPrevious(); } 118 119 public int nextIndex() 120 { return i.nextIndex(); } 121 122 public double previous() 123 { return i.previous(); } 124 125 public int previousIndex() 126 { return i.previousIndex(); } 127 128 public void set(double v) 129 { Exceptions.unmodifiable("list"); } 130 }; 131 } 132 133 139 public double removeElementAt(int index) 140 { Exceptions.unmodifiable("list"); throw new RuntimeException (); } 141 142 148 public double set(int index, double v) 149 { Exceptions.unmodifiable("list"); throw new RuntimeException (); } 150 151 } | Popular Tags |