JavaPatternMatching/src/de/dhbwstuttgart/syntaxtree/statement/Statement.java

135 lines
4.0 KiB
Java
Raw Normal View History

2013-10-18 11:33:46 +00:00
// ino.module.Statement.8652.package
2014-09-02 08:33:54 +00:00
package de.dhbwstuttgart.syntaxtree.statement;
2013-10-18 11:33:46 +00:00
// ino.end
// ino.module.Statement.8652.import
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
2014-09-04 14:35:44 +00:00
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.core.IItemWithOffset;
2014-09-04 14:35:44 +00:00
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
import de.dhbwstuttgart.myexception.JVMCodeException;
import de.dhbwstuttgart.myexception.SCStatementException;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.syntaxtree.Class;
2014-09-04 14:35:44 +00:00
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
2014-09-08 13:12:47 +00:00
import de.dhbwstuttgart.typeinference.Pair;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.Typeable;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
2013-10-18 11:33:46 +00:00
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
// ino.class.Statement.26184.declaration
public abstract class Statement extends SyntaxTreeNode implements IItemWithOffset, Typeable
2013-10-18 11:33:46 +00:00
// ino.end
// ino.class.Statement.26184.body
{
// ino.attribute.offset.26188.declaration
2014-02-19 04:20:54 +00:00
protected int offset;
2013-10-18 11:33:46 +00:00
// 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<Type> paralist, Vector<GenericTypeVar> genericMethodParameters);
// ino.end
/**
* @author AI10023 - Andreas Stadelmeier
* Implementierung des Java 8 - Typinferenzalgorithmus von Martin Pl<EFBFBD>micke
* Jedes Statement wird im Zuge des Algorithmus durch die TYPEExpr-Funktion angesprochen.
*/
public abstract ConstraintsSet TYPEStmt(TypeAssumptions assumptions);
public Type getType(){
2013-10-18 11:33:46 +00:00
return type;
}
/**
* @author Andreas Stadelmeier, a10023
* Sollte von jedem Statement <EFBFBD>berschrieben werden.
* Liefert Informationen zum Statment und dessen Typ.
* @return
*/
public String getTypeInformation(){
return this.printJavaCode(new ResultSet(new Vector<Pair>()))+" : "+type.toString();
}
/**
* @author AI10023 - Andreas Stadelmeier
* Jedem Statement und jeder Expression wird im Zuge des Typinferenzalgorithmus eine Typvariable zugewiesen.
* Daher m<EFBFBD>ssen alle Statements und Expressions die Methoden setTypeVariable und getTypeVariable implementieren.
2013-10-18 11:33:46 +00:00
*/
public void setType(Type t)
{
this.type=t;
}
public abstract JavaCodeResult printJavaCode(ResultSet resultSet);
2014-03-17 16:55:55 +00:00
@Override
public String getDescription(){
return this.printJavaCode(new ResultSet(new Vector<Pair>())).toString();
}
public void setReturnType(Type t){
}
public Type getReturnType(){
2014-09-02 08:33:54 +00:00
return new de.dhbwstuttgart.syntaxtree.type.Void(-1);
}
2013-10-18 11:33:46 +00:00
}
// ino.end