// ino.module.Statement.8652.package package mycompiler.mystatement; // ino.end // ino.module.Statement.8652.import import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import sun.reflect.generics.reflectiveObjects.NotImplementedException; import typinferenz.ConstraintsSet; import typinferenz.JavaCodeResult; import typinferenz.ResultSet; import typinferenz.Typeable; import typinferenz.assumptions.TypeAssumptions; import mycompiler.IItemWithOffset; import mycompiler.SyntaxTreeNode; import mycompiler.mybytecode.ClassFile; import mycompiler.mybytecode.CodeAttribute; import mycompiler.myclass.Class; import mycompiler.myexception.CTypeReconstructionException; import mycompiler.myexception.JVMCodeException; import mycompiler.myexception.SCStatementException; import mycompiler.mytype.GenericTypeVar; import mycompiler.mytype.Pair; import mycompiler.mytype.Type; import mycompiler.mytype.TypePlaceholder; import mycompiler.mytypereconstruction.CSupportData; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; import mycompiler.mytypereconstruction.set.CSubstitutionSet; import mycompiler.mytypereconstruction.set.CTripleSet; import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; // ino.end // ino.class.Statement.26184.declaration public abstract class Statement implements IItemWithOffset, Typeable, ITypeReplacementListener, SyntaxTreeNode // ino.end // ino.class.Statement.26184.body { // ino.attribute.offset.26188.declaration private int offset; // ino.end // ino.attribute.variableLength.26191.declaration private int variableLength; // ino.end protected Type type; // ino.method.Statement.26194.definition public Statement(int offset, int variableLength) // ino.end // ino.method.Statement.26194.body { this.offset=offset; this.variableLength=variableLength; } // ino.end // ino.method.getOffset.26197.definition public int getOffset() // ino.end // ino.method.getOffset.26197.body { return offset; } // ino.end // ino.method.getVariableLength.26200.definition public int getVariableLength() // ino.end // ino.method.getVariableLength.26200.body { return variableLength; } // ino.end // ino.method.codegen.26206.declaration public abstract void codegen(ClassFile classfile, CodeAttribute code, Vector paralist) throws JVMCodeException; // ino.end // ino.method.wandleRefTypeAttributes2GenericAttributes.26224.declaration public abstract void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters); // ino.end public abstract boolean addOffsetsToStatement(CTypeAssumption localAssumption, String NameVariable, boolean isMemberVariable); /** * @author AI10023 - Andreas Stadelmeier * Implementierung des Java 8 - Typinferenzalgorithmus von Martin Plümicke * Jedes Statement wird im Zuge des Algorithmus durch die TYPEExpr-Funktion angesprochen. */ public abstract ConstraintsSet TYPEStmt(TypeAssumptions assumptions); public Type getType(){ return type; } /** * @author Andreas Stadelmeier, a10023 * Sollte von jedem Statement überschrieben werden. * Liefert Informationen zum Statment und dessen Typ. * @return */ public String getTypeInformation(){ return this.printJavaCode(new ResultSet(new Vector()))+" : "+type.toString(); } /** * @author AI10023 - Andreas Stadelmeier * Jedem Statement und jeder Expression wird im Zuge des Typinferenzalgorithmus eine Typvariable zugewiesen. * Daher müssen alle Statements und Expressions die Methoden setTypeVariable und getTypeVariable implementieren. */ public void setType(Type t) { if(this.getType() instanceof TypePlaceholder){ ((TypePlaceholder)this.getType()).removeReplacementListener(this); } if(t instanceof TypePlaceholder){ ((TypePlaceholder)t).addReplacementListener(this); } this.type=t; } public void replaceType(CReplaceTypeEvent e) { if(getType() instanceof TypePlaceholder){ ((TypePlaceholder)getType()).removeReplacementListener(this); } this.setType(e.getNewType()); } public abstract JavaCodeResult printJavaCode(ResultSet resultSet); } // ino.end