forked from JavaTX/JavaCompilerCore
141 lines
3.8 KiB
Java
Executable File
141 lines
3.8 KiB
Java
Executable File
// ino.module.InterfaceBody.8583.package
|
|
package de.dhbwstuttgart.syntaxtree;
|
|
// ino.end
|
|
|
|
// ino.module.InterfaceBody.8583.import
|
|
import java.util.Vector;
|
|
|
|
import de.dhbwstuttgart.bytecode.ClassFile;
|
|
import de.dhbwstuttgart.myexception.JVMCodeException;
|
|
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
|
|
|
// ino.class.InterfaceBody.23984.description type=javadoc
|
|
/**
|
|
* Die Klasse enthaelt den Inhalt eines Interfaces, also Konstanten-
|
|
* und Mehtodendefinitionen.
|
|
* @author SCJU
|
|
*
|
|
*/
|
|
// ino.end
|
|
// ino.class.InterfaceBody.23984.declaration
|
|
public class InterfaceBody
|
|
// ino.end
|
|
// ino.class.InterfaceBody.23984.body
|
|
{
|
|
|
|
// ino.attribute.ConstantVektor.23987.declaration
|
|
protected Vector<Constant> ConstantVektor = new Vector<Constant>();
|
|
// ino.end
|
|
// ino.attribute.MethodVektor.23990.declaration
|
|
protected Vector<Method> MethodVektor = new Vector<Method>();
|
|
// ino.end
|
|
|
|
// ino.method.InterfaceBody.23993.defdescription type=line
|
|
// Konstruktoren
|
|
// ino.end
|
|
// ino.method.InterfaceBody.23993.definition
|
|
public InterfaceBody()
|
|
// ino.end
|
|
// ino.method.InterfaceBody.23993.body
|
|
{
|
|
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.addElement.23996.defdescription type=javadoc
|
|
/**
|
|
* Fuegt ein neues Element (Konstantendefinition oder abstrakte
|
|
* Methode) ein.
|
|
*/
|
|
// ino.end
|
|
// ino.method.addElement.23996.definition
|
|
public void addElement(Field fd)
|
|
// ino.end
|
|
// ino.method.addElement.23996.body
|
|
{
|
|
if (fd instanceof Constant) {
|
|
ConstantVektor.addElement((Constant) fd);
|
|
} else if (fd instanceof Method) {
|
|
MethodVektor.addElement((Method) fd);
|
|
}
|
|
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.getConstantVektor.23999.definition
|
|
public Vector<Constant> getConstantVektor()
|
|
// ino.end
|
|
// ino.method.getConstantVektor.23999.body
|
|
{
|
|
return ConstantVektor;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.setConstantVektor.24002.definition
|
|
public void setConstantVektor(Vector<Constant> constantVektor)
|
|
// ino.end
|
|
// ino.method.setConstantVektor.24002.body
|
|
{
|
|
ConstantVektor = constantVektor;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.getMethodVektor.24005.definition
|
|
public Vector<Method> getMethodVektor()
|
|
// ino.end
|
|
// ino.method.getMethodVektor.24005.body
|
|
{
|
|
return MethodVektor;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.setMethodVektor.24008.definition
|
|
public void setMethodVektor(Vector<Method> methodVektor)
|
|
// ino.end
|
|
// ino.method.setMethodVektor.24008.body
|
|
{
|
|
MethodVektor = methodVektor;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.codegen.24011.definition
|
|
public void codegen(ClassFile cf, Vector paralist)
|
|
throws JVMCodeException
|
|
// ino.end
|
|
// ino.method.codegen.24011.body
|
|
{
|
|
|
|
// Constanten verarbeiten
|
|
for (int i=0; i < ConstantVektor.size(); i++) {
|
|
ConstantVektor.elementAt(i).codegen(cf, paralist);
|
|
}
|
|
|
|
// Methodenheader verarbeiten
|
|
for (int i=0; i < MethodVektor.size(); i++) {
|
|
Method m = MethodVektor.elementAt(i);
|
|
|
|
Modifiers mod = m.getDeclIdVector().elementAt(0).get_Modifiers();
|
|
|
|
if (mod != null){
|
|
mod.ensureAbstract();
|
|
mod.ensurePublic();
|
|
} else {
|
|
mod = new Modifiers();
|
|
mod.ensureAbstract();
|
|
mod.ensurePublic();
|
|
m.getDeclIdVector().elementAt(0).set_Modifiers(mod);
|
|
}
|
|
|
|
|
|
// Sicherstellen, dass kein Bytecode innerhalb
|
|
// der Methode generiert wird.
|
|
m.setAbstract(true);
|
|
m.codegen(cf, paralist);
|
|
}
|
|
}
|
|
// ino.end
|
|
|
|
|
|
}
|
|
// ino.end
|