package de.dhbwstuttgart.syntaxtree.statement; import de.dhbwstuttgart.syntaxtree.FormalParameter; import de.dhbwstuttgart.syntaxtree.Pattern; import org.antlr.v4.runtime.Token; import de.dhbwstuttgart.syntaxtree.StatementVisitor; import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; public class InstanceOf extends Expression { private final Pattern pattern; private final Expression expr; public InstanceOf(Expression expr, RefTypeOrTPHOrWildcardOrGeneric type, RefTypeOrTPHOrWildcardOrGeneric reftype, Token offset) { super(type, offset); this.pattern = new FormalParameter(null, reftype, offset); this.expr = expr; } public InstanceOf(Expression expr, RefTypeOrTPHOrWildcardOrGeneric type, Pattern pattern, Token offset) { super(type, offset); this.pattern = pattern; this.expr = expr; } public Pattern getPattern() { return pattern; } public Expression getExpression() { return expr; } @Override public void accept(StatementVisitor visitor) { visitor.visit(this); } }