Initial commit of main compiler sources (or should I say ... SAUCES!)
This commit is contained in:
43
slangc/api/CompilerSet.sauce
Normal file
43
slangc/api/CompilerSet.sauce
Normal file
@ -0,0 +1,43 @@
|
||||
package slangc.api;
|
||||
|
||||
import slangc.codegraph.DynamicSet;
|
||||
|
||||
public class CompilerSet extends DynamicSet {
|
||||
|
||||
public CompilerSet() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompilerWorld getEnclosingContainer() {
|
||||
return (CompilerWorld) super.getEnclosingContainer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompilerPackage getNamedElement(int index) {
|
||||
// TODO Auto-generated method stub
|
||||
return (CompilerPackage) super.getNamedElement(index);
|
||||
}
|
||||
|
||||
public CompilerPackage findPackageOrNull(String name) {
|
||||
for (int i = 0; i < countNamedElements(); i++) {
|
||||
CompilerPackage p = getNamedElement(i);
|
||||
if (p.getSimpleName().equals(name)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public CompilerPackage findPackageOrCreate(String name) {
|
||||
CompilerPackage result = findPackageOrNull(name);
|
||||
|
||||
if (result == null) {
|
||||
result = new CompilerPackage();
|
||||
result.setSimpleName(name);
|
||||
appendNamedElement(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user