88 lines
2.0 KiB
Plaintext
88 lines
2.0 KiB
Plaintext
|
package slangc.codegraph;
|
||
|
|
||
|
public class DynamicNamedElement implements AbstractNamedElement {
|
||
|
private AbstractContainer container = null;
|
||
|
private String name = "";
|
||
|
private Object compilerObject = null;
|
||
|
|
||
|
public void setEnclosingContainer(AbstractContainer container) {
|
||
|
if (this.container != null) {
|
||
|
throw new Error("Container is already set.");
|
||
|
}
|
||
|
|
||
|
this.container = container;
|
||
|
}
|
||
|
|
||
|
public AbstractContainer getEnclosingContainer() {
|
||
|
return container;
|
||
|
}
|
||
|
|
||
|
public void setSimpleName(String name) {
|
||
|
if (!this.name.equals("")) {
|
||
|
throw new Error("SimpleName is already set.");
|
||
|
}
|
||
|
this.name = name;
|
||
|
}
|
||
|
|
||
|
public String getSimpleName() {
|
||
|
// TODO Auto-generated method stub
|
||
|
return name;
|
||
|
}
|
||
|
|
||
|
public String getFullName() {
|
||
|
if (container != null && container != getSet()) {
|
||
|
return container.getFullName() + "." + getSimpleName();
|
||
|
} else {
|
||
|
return getSimpleName();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public AbstractTypeDefinition getType() {
|
||
|
if (this instanceof AbstractTypeDefinition) {
|
||
|
return (AbstractTypeDefinition) this;
|
||
|
} else if (container != null) {
|
||
|
return container.getType();
|
||
|
} else {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public AbstractPackage getPackage() {
|
||
|
if (this instanceof AbstractPackage) {
|
||
|
return (AbstractPackage) this;
|
||
|
} else if (container != null) {
|
||
|
return container.getPackage();
|
||
|
} else {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public AbstractSet getSet() {
|
||
|
if (this instanceof AbstractSet) {
|
||
|
return (AbstractSet) this;
|
||
|
} else if (container != null) {
|
||
|
return container.getSet();
|
||
|
} else {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public AbstractWorld getWorld() {
|
||
|
if (this instanceof AbstractWorld) {
|
||
|
return (AbstractWorld) this;
|
||
|
} else if (container != null) {
|
||
|
return container.getWorld();
|
||
|
} else {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Object getCompilerObject() {
|
||
|
return compilerObject;
|
||
|
}
|
||
|
|
||
|
public void setCompilerObject(Object compilerObject) {
|
||
|
this.compilerObject = compilerObject;
|
||
|
}
|
||
|
}
|