equal
deleted
inserted
replaced
150 |
150 |
151 def iterator(elem: A): Iterator[A] = |
151 def iterator(elem: A): Iterator[A] = |
152 if (contains(elem)) make_iterator(Some(elem)) |
152 if (contains(elem)) make_iterator(Some(elem)) |
153 else throw new Linear_Set.Undefined(elem) |
153 else throw new Linear_Set.Undefined(elem) |
154 |
154 |
|
155 def iterator(from: A, to: A): Iterator[A] = |
|
156 if (!contains(to)) throw new Linear_Set.Undefined(to) |
|
157 else |
|
158 nexts.get(to) match { |
|
159 case None => iterator(from) |
|
160 case Some(stop) => iterator(from).takeWhile(_ != stop) |
|
161 } |
|
162 |
155 def + (elem: A): Linear_Set[A] = insert_after(end, elem) |
163 def + (elem: A): Linear_Set[A] = insert_after(end, elem) |
156 |
164 |
157 def - (elem: A): Linear_Set[A] = |
165 def - (elem: A): Linear_Set[A] = |
158 if (!contains(elem)) throw new Linear_Set.Undefined(elem) |
166 if (!contains(elem)) throw new Linear_Set.Undefined(elem) |
159 else delete_after(prev(elem)) |
167 else delete_after(prev(elem)) |