summaryrefslogtreecommitdiff
path: root/sources/scalac
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2005-11-28 09:55:19 +0000
committermichelou <michelou@epfl.ch>2005-11-28 09:55:19 +0000
commitbcf48fb54ea1cf3b98044ce604769ef0f5972645 (patch)
treeaf59487ed65b176a7f84c0e22c05c57140c00db5 /sources/scalac
parent6f3451e92f6f40873d52ae2fab4e97ea8899bdf6 (diff)
downloadscala-bcf48fb54ea1cf3b98044ce604769ef0f5972645.tar.gz
scala-bcf48fb54ea1cf3b98044ce604769ef0f5972645.tar.bz2
scala-bcf48fb54ea1cf3b98044ce604769ef0f5972645.zip
- removed leading tabs
Diffstat (limited to 'sources/scalac')
-rw-r--r--sources/scalac/symtab/SymSet.java122
1 files changed, 62 insertions, 60 deletions
diff --git a/sources/scalac/symtab/SymSet.java b/sources/scalac/symtab/SymSet.java
index d6545eacbf..0f91985386 100644
--- a/sources/scalac/symtab/SymSet.java
+++ b/sources/scalac/symtab/SymSet.java
@@ -1,6 +1,6 @@
/* ____ ____ ____ ____ ______ *\
** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
+** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002-2005, LAMP/EPFL **
** /_____/\____/\___/\____/____/ **
\* */
@@ -17,94 +17,96 @@ public class SymSet {
public SymSet() {}
private SymSet(Symbol sym, SymSet l, SymSet r) {
- this.sym = sym; this.l = l; this.r = r;
+ this.sym = sym; this.l = l; this.r = r;
}
/** Union of this set and `{sym}'.
*/
public SymSet incl(Symbol sym) {
- if (this == EMPTY) {
- return new SymSet(sym, EMPTY, EMPTY);
- } else if (sym == this.sym) {
- return this;
- } else if (less(sym, this.sym)) {
- return new SymSet(this.sym, l.incl(sym), r);
- } else {
- assert less(this.sym, sym);
- return new SymSet(this.sym, l, r.incl(sym));
- }
+ if (this == EMPTY) {
+ return new SymSet(sym, EMPTY, EMPTY);
+ } else if (sym == this.sym) {
+ return this;
+ } else if (less(sym, this.sym)) {
+ return new SymSet(this.sym, l.incl(sym), r);
+ } else {
+ assert less(this.sym, sym);
+ return new SymSet(this.sym, l, r.incl(sym));
+ }
}
+ /** Remove the element <code>sym</code> from the symbol set
+ */
public SymSet excl(Symbol sym) {
- if (sym == this.sym) {
- if (l == EMPTY) return r;
- if (r == EMPTY) return l;
- SymSet m = r;
- if (m.l != EMPTY) {
- SymSet p;
- do {
- p = m;
- m = m.l;
- } while (m.l != EMPTY);
- p.l = m.r;
- m.r = r;
- }
- m.l = l;
- return m;
- } else if (less(sym, this.sym)) {
- return new SymSet(this.sym, l.excl(sym), r);
- } else {
- assert less(this.sym, sym);
- return new SymSet(this.sym, l, r.excl(sym));
- }
+ if (sym == this.sym) {
+ if (l == EMPTY) return r;
+ if (r == EMPTY) return l;
+ SymSet m = r;
+ if (m.l != EMPTY) {
+ SymSet p;
+ do {
+ p = m;
+ m = m.l;
+ } while (m.l != EMPTY);
+ p.l = m.r;
+ m.r = r;
+ }
+ m.l = l;
+ return m;
+ } else if (less(sym, this.sym)) {
+ return new SymSet(this.sym, l.excl(sym), r);
+ } else {
+ assert less(this.sym, sym);
+ return new SymSet(this.sym, l, r.excl(sym));
+ }
}
/** Is `sym' an element of this set?
*/
public boolean contains(Symbol sym) {
- if (this == EMPTY) {
- return false;
- } else if (sym == this.sym) {
- return true;
- } else if (less(sym, this.sym)) {
- return l.contains(sym);
- } else {
- assert less(this.sym, sym);
- return r.contains(sym);
- }
+ if (this == EMPTY) {
+ return false;
+ } else if (sym == this.sym) {
+ return true;
+ } else if (less(sym, this.sym)) {
+ return l.contains(sym);
+ } else {
+ assert less(this.sym, sym);
+ return r.contains(sym);
+ }
}
/** The number of elements in ths set.
*/
public int size() {
- if (this == EMPTY) {
- return 0;
- } else {
- return 1 + l.size() + r.size();
- }
+ if (this == EMPTY) {
+ return 0;
+ } else {
+ return 1 + l.size() + r.size();
+ }
}
/** Copy elements of this set into `ss', starting at index `from'.
* Return index one past last element copied.
*/
public int copyToArray(Symbol[] ss, int from) {
- if (this == EMPTY) {
- return from;
- } else {
- from = l.copyToArray(ss, from);
- ss[from] = sym;
- return r.copyToArray(ss, from + 1);
- }
+ if (this == EMPTY) {
+ return from;
+ } else {
+ from = l.copyToArray(ss, from);
+ ss[from] = sym;
+ return r.copyToArray(ss, from + 1);
+ }
}
/** Return all elements of this set as an array.
*/
public Symbol[] toArray() {
- int s = size();
- if (s == 0) return Symbol.EMPTY_ARRAY;
- Symbol[] ss = new Symbol[s];
- copyToArray(ss, 0);
- return ss;
+ int s = size();
+ if (s == 0) return Symbol.EMPTY_ARRAY;
+ Symbol[] ss = new Symbol[s];
+ copyToArray(ss, 0);
+ return ss;
}
/** The empty set.