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

191 lines
5.3 KiB
Java
Raw Normal View History

2013-10-18 11:33:46 +00:00
// ino.module.NotExpr.8643.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.NotExpr.8643.import
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
2013-10-18 11:33:46 +00:00
import mycompiler.mybytecode.ClassFile;
import mycompiler.mybytecode.CodeAttribute;
import mycompiler.myexception.CTypeReconstructionException;
import mycompiler.myexception.JVMCodeException;
import mycompiler.myexception.SCStatementException;
import mycompiler.mytypereconstruction.CSupportData;
import mycompiler.mytypereconstruction.CTriple;
import mycompiler.mytypereconstruction.set.CSubstitutionSet;
import mycompiler.mytypereconstruction.set.CTripleSet;
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption;
import mycompiler.mytypereconstruction.unify.Unify;
2013-10-18 11:33:46 +00:00
import org.apache.log4j.Logger;
// ino.end
2014-04-23 15:59:39 +00:00
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.core.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.type.BooleanType;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.Pair;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.Void;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.OderConstraint;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
2013-10-18 11:33:46 +00:00
// ino.class.NotExpr.25873.declaration
public class NotExpr extends UnaryExpr
// ino.end
// ino.class.NotExpr.25873.body
{
// ino.method.NotExpr.25877.definition
public NotExpr(int offset,int variableLength)
// ino.end
// ino.method.NotExpr.25877.body
{
super(offset,variableLength);
}
// ino.end
// ino.attribute.not.25880.declaration
private UnaryNot not;
// ino.end
// ino.attribute.expr.25883.declaration
public Expr expr;
// ino.end
// ino.attribute.parserlog.25886.declaration
protected static Logger parserlog = Logger.getLogger("parser");
// ino.end
// ino.method.get_Name.25892.definition
public String get_Name()
// ino.end
// ino.method.get_Name.25892.body
{
return null;
}
// ino.end
// ino.method.get_Expr.25895.definition
public Expr get_Expr()
// ino.end
// ino.method.get_Expr.25895.body
{
return expr;
}
// ino.end
// ino.method.set_UnaryNot.25898.definition
public void set_UnaryNot(UnaryNot unot)
// ino.end
// ino.method.set_UnaryNot.25898.body
{
this.not = unot;
}
// ino.end
// ino.method.set_Expr.25901.definition
public void set_Expr(Expr ex)
// ino.end
// ino.method.set_Expr.25901.body
{
this.expr = ex;
}
// ino.end
// ino.method.codegen.25904.definition
public void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
throws JVMCodeException
// ino.end
// ino.method.codegen.25904.body
{
if(expr instanceof Binary) ((Binary)expr).not_codegen(classfile, code, paralist);
else if(expr instanceof NotExpr) ((NotExpr)expr).not_codegen(classfile, code, paralist);
else {
expr.codegen(classfile, code, paralist);
not.codegen(classfile, code, true);
}
}
// ino.end
// ino.method.not_codegen.25907.definition
public void not_codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
throws JVMCodeException
// ino.end
// ino.method.not_codegen.25907.body
{
if(expr instanceof Binary) ((Binary)expr).codegen(classfile, code, paralist);
else if(expr instanceof NotExpr) ((NotExpr)expr).codegen(classfile, code, paralist);
else {
expr.codegen(classfile, code, paralist);
not.codegen(classfile, code, false);
}
}
// ino.end
/*
public void if_codegen(ClassFile classfile, Code_attribute code, boolean sw) throws JVMCodeException {
if(expr instanceof NotExpr) if_codegen(classfile, code, !sw);
else {
expr.codegen(classfile, code);
not.if_codegen(classfile, code, sw);
}
}
*/
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.25916.definition
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.25916.body
{
}
// ino.end
public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable)
{
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
}
@Override
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
2014-04-23 15:59:39 +00:00
ConstraintsSet ret = new ConstraintsSet();
OderConstraint constraint = new OderConstraint();
constraint.addConstraint(new Pair(this.getType(), new BooleanType()));
ret.add(constraint);
return ret;
2013-10-18 11:33:46 +00:00
}
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
// TODO Auto-generated method stub
return null;
}
@Override
public Vector<SyntaxTreeNode> getChildren() {
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
ret.add(this.expr);
return ret;
}
2013-10-18 11:33:46 +00:00
}
// ino.end