author | wenzelm |
Sun, 30 Aug 2015 21:26:42 +0200 | |
changeset 61057 | 5f6a1e31f3ad |
parent 59319 | 677615cba30d |
child 64370 | 865b39487b5d |
permissions | -rw-r--r-- |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
1 |
/* Title: Pure/General/linear_set.scala |
46686 | 2 |
Module: PIDE |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
3 |
Author: Makarius |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
4 |
Author: Fabian Immler, TU Munich |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
5 |
|
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
6 |
Sets with canonical linear order, or immutable linked-lists. |
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
7 |
*/ |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
8 |
|
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
9 |
package isabelle |
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
10 |
|
55618 | 11 |
|
36011
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
12 |
import scala.collection.SetLike |
56658
86f9c6912965
accomodate scala-2.11.0: evade somewhat erratic fix of ImmutableSetFactory in Scala/bfa70315d72d;
wenzelm
parents:
55618
diff
changeset
|
13 |
import scala.collection.generic.{SetFactory, CanBuildFrom, GenericSetTemplate, GenericCompanion} |
86f9c6912965
accomodate scala-2.11.0: evade somewhat erratic fix of ImmutableSetFactory in Scala/bfa70315d72d;
wenzelm
parents:
55618
diff
changeset
|
14 |
import scala.collection.mutable.{Builder, SetBuilder} |
86f9c6912965
accomodate scala-2.11.0: evade somewhat erratic fix of ImmutableSetFactory in Scala/bfa70315d72d;
wenzelm
parents:
55618
diff
changeset
|
15 |
import scala.language.higherKinds |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
16 |
|
36011
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
17 |
|
56658
86f9c6912965
accomodate scala-2.11.0: evade somewhat erratic fix of ImmutableSetFactory in Scala/bfa70315d72d;
wenzelm
parents:
55618
diff
changeset
|
18 |
object Linear_Set extends SetFactory[Linear_Set] |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
19 |
{ |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
20 |
private val empty_val: Linear_Set[Nothing] = new Linear_Set[Nothing](None, None, Map(), Map()) |
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
21 |
override def empty[A] = empty_val.asInstanceOf[Linear_Set[A]] |
32465 | 22 |
|
36011
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
23 |
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Linear_Set[A]] = setCanBuildFrom[A] |
56658
86f9c6912965
accomodate scala-2.11.0: evade somewhat erratic fix of ImmutableSetFactory in Scala/bfa70315d72d;
wenzelm
parents:
55618
diff
changeset
|
24 |
def newBuilder[A]: Builder[A, Linear_Set[A]] = new SetBuilder[A, Linear_Set[A]](empty[A]) |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
25 |
|
38448
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
26 |
class Duplicate[A](x: A) extends Exception |
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
27 |
class Undefined[A](x: A) extends Exception |
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
28 |
class Next_Undefined[A](x: Option[A]) extends Exception |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
29 |
} |
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
30 |
|
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
31 |
|
46712 | 32 |
final class Linear_Set[A] private( |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
33 |
start: Option[A], end: Option[A], val nexts: Map[A, A], prevs: Map[A, A]) |
36011
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
34 |
extends scala.collection.immutable.Set[A] |
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
35 |
with GenericSetTemplate[A, Linear_Set] |
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
36 |
with SetLike[A, Linear_Set[A]] |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
37 |
{ |
36011
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
38 |
override def companion: GenericCompanion[Linear_Set] = Linear_Set |
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
39 |
|
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
40 |
|
38448
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
41 |
/* relative addressing */ |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
42 |
|
48761
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
43 |
def next(elem: A): Option[A] = |
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
44 |
if (contains(elem)) nexts.get(elem) |
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
45 |
else throw new Linear_Set.Undefined(elem) |
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
46 |
|
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
47 |
def prev(elem: A): Option[A] = |
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
48 |
if (contains(elem)) prevs.get(elem) |
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
49 |
else throw new Linear_Set.Undefined(elem) |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
50 |
|
38368 | 51 |
def get_after(hook: Option[A]): Option[A] = |
52 |
hook match { |
|
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
53 |
case None => start |
48761
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
54 |
case Some(elem) => next(elem) |
38368 | 55 |
} |
56 |
||
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
57 |
def insert_after(hook: Option[A], elem: A): Linear_Set[A] = |
38448
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
58 |
if (contains(elem)) throw new Linear_Set.Duplicate(elem) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
59 |
else |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
60 |
hook match { |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
61 |
case None => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
62 |
start match { |
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
63 |
case None => new Linear_Set[A](Some(elem), Some(elem), Map(), Map()) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
64 |
case Some(elem1) => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
65 |
new Linear_Set[A](Some(elem), end, |
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
66 |
nexts + (elem -> elem1), prevs + (elem1 -> elem)) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
67 |
} |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
68 |
case Some(elem1) => |
38448
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
69 |
if (!contains(elem1)) throw new Linear_Set.Undefined(elem1) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
70 |
else |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
71 |
nexts.get(elem1) match { |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
72 |
case None => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
73 |
new Linear_Set[A](start, Some(elem), |
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
74 |
nexts + (elem1 -> elem), prevs + (elem -> elem1)) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
75 |
case Some(elem2) => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
76 |
new Linear_Set[A](start, end, |
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
77 |
nexts + (elem1 -> elem) + (elem -> elem2), |
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
78 |
prevs + (elem2 -> elem) + (elem -> elem1)) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
79 |
} |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
80 |
} |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
81 |
|
48753 | 82 |
def append_after(hook: Option[A], elems: Seq[A]): Linear_Set[A] = // FIXME reverse fold |
48748
89b4e7d83d6f
refined recover_spans: take visible range into account, reparse and trim results -- to improve editing experience wrt. unbalanced quotations etc.;
wenzelm
parents:
48747
diff
changeset
|
83 |
((hook, this) /: elems) { |
89b4e7d83d6f
refined recover_spans: take visible range into account, reparse and trim results -- to improve editing experience wrt. unbalanced quotations etc.;
wenzelm
parents:
48747
diff
changeset
|
84 |
case ((last, set), elem) => (Some(elem), set.insert_after(last, elem)) |
89b4e7d83d6f
refined recover_spans: take visible range into account, reparse and trim results -- to improve editing experience wrt. unbalanced quotations etc.;
wenzelm
parents:
48747
diff
changeset
|
85 |
}._2 |
89b4e7d83d6f
refined recover_spans: take visible range into account, reparse and trim results -- to improve editing experience wrt. unbalanced quotations etc.;
wenzelm
parents:
48747
diff
changeset
|
86 |
|
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
87 |
def delete_after(hook: Option[A]): Linear_Set[A] = |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
88 |
hook match { |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
89 |
case None => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
90 |
start match { |
38448
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
91 |
case None => throw new Linear_Set.Next_Undefined[A](None) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
92 |
case Some(elem1) => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
93 |
nexts.get(elem1) match { |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
94 |
case None => empty |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
95 |
case Some(elem2) => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
96 |
new Linear_Set[A](Some(elem2), end, nexts - elem1, prevs - elem2) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
97 |
} |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
98 |
} |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
99 |
case Some(elem1) => |
38448
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
100 |
if (!contains(elem1)) throw new Linear_Set.Undefined(elem1) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
101 |
else |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
102 |
nexts.get(elem1) match { |
38448
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
103 |
case None => throw new Linear_Set.Next_Undefined(Some(elem1)) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
104 |
case Some(elem2) => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
105 |
nexts.get(elem2) match { |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
106 |
case None => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
107 |
new Linear_Set[A](start, Some(elem1), nexts - elem1, prevs - elem2) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
108 |
case Some(elem3) => |
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
109 |
new Linear_Set[A](start, end, |
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
110 |
nexts - elem2 + (elem1 -> elem3), |
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
111 |
prevs - elem2 + (elem3 -> elem1)) |
32576
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
112 |
} |
20b261654e33
double linking for improved performance of "prev";
wenzelm
parents:
32465
diff
changeset
|
113 |
} |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
114 |
} |
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
115 |
|
32465 | 116 |
|
117 |
/* Set methods */ |
|
118 |
||
119 |
override def stringPrefix = "Linear_Set" |
|
120 |
||
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
121 |
override def isEmpty: Boolean = !start.isDefined |
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
122 |
override def size: Int = if (isEmpty) 0 else nexts.size + 1 |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
123 |
|
34304 | 124 |
def contains(elem: A): Boolean = |
59319 | 125 |
nonEmpty && (end.get == elem || nexts.isDefinedAt(elem)) |
34304 | 126 |
|
48746
9e1b2aafbc7f
more direct Linear_Set.reverse, swapping orientation of the graph;
wenzelm
parents:
46712
diff
changeset
|
127 |
private def make_iterator(from: Option[A]): Iterator[A] = new Iterator[A] { |
46620 | 128 |
private var next_elem = from |
38583 | 129 |
def hasNext(): Boolean = next_elem.isDefined |
130 |
def next(): A = |
|
34301 | 131 |
next_elem match { |
132 |
case Some(elem) => |
|
48746
9e1b2aafbc7f
more direct Linear_Set.reverse, swapping orientation of the graph;
wenzelm
parents:
46712
diff
changeset
|
133 |
next_elem = nexts.get(elem) |
34301 | 134 |
elem |
38583 | 135 |
case None => Iterator.empty.next() |
34301 | 136 |
} |
32464
5b9731f83569
added linear_set.scala from http://isabelle.in.tum.de/repos/isabelle-jedit/rev/d567692f9717
wenzelm
parents:
diff
changeset
|
137 |
} |
32465 | 138 |
|
48746
9e1b2aafbc7f
more direct Linear_Set.reverse, swapping orientation of the graph;
wenzelm
parents:
46712
diff
changeset
|
139 |
override def iterator: Iterator[A] = make_iterator(start) |
34304 | 140 |
|
36011
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34304
diff
changeset
|
141 |
def iterator(elem: A): Iterator[A] = |
48746
9e1b2aafbc7f
more direct Linear_Set.reverse, swapping orientation of the graph;
wenzelm
parents:
46712
diff
changeset
|
142 |
if (contains(elem)) make_iterator(Some(elem)) |
38448
62d16c415019
added functor Linear_Set, based on former adhoc structures in document.ML;
wenzelm
parents:
38368
diff
changeset
|
143 |
else throw new Linear_Set.Undefined(elem) |
32465 | 144 |
|
48747 | 145 |
def iterator(from: A, to: A): Iterator[A] = |
48761
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
146 |
if (contains(to)) |
48747 | 147 |
nexts.get(to) match { |
148 |
case None => iterator(from) |
|
149 |
case Some(stop) => iterator(from).takeWhile(_ != stop) |
|
150 |
} |
|
48761
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
151 |
else throw new Linear_Set.Undefined(to) |
48747 | 152 |
|
48753 | 153 |
def reverse: Linear_Set[A] = new Linear_Set(end, start, prevs, nexts) |
154 |
||
155 |
override def last: A = reverse.head |
|
156 |
||
46621
7a8dd77c9f93
streamlined abstract datatype, eliminating odd representation class;
wenzelm
parents:
46620
diff
changeset
|
157 |
def + (elem: A): Linear_Set[A] = insert_after(end, elem) |
32465 | 158 |
|
48761
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
159 |
def - (elem: A): Linear_Set[A] = delete_after(prev(elem)) |
6a355b4b6a59
clarified Linear_Set.next/prev: check definedness;
wenzelm
parents:
48753
diff
changeset
|
160 |
} |