Ayuda con error: bad operand types for binary operator ">="
Publicado por wendymika (4 intervenciones) el 27/11/2019 06:02:43

Como puedo solucionar el error ?
no puedo cambiar el tipo de metodo , tiene que ser siempre Integer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
@Override public Integer visitRelationalExpr(GramaticaParser.RelationalExprContext ctx)
{
int left = visit(ctx.expr(0));
int right = visit(ctx.expr(1));
boolean bool = (left == visit(ctx.expr(0)));
boolean bool1 = (right == visit(ctx.expr(1)));
switch (ctx.operacion.getType()) {
case GramaticaParser.MENOR:
return bool < bool1;
case GramaticaParser.MENOR_IGUAL:
return bool <= bool1;
case GramaticaParser.MAYOR:
return bool > bool1;
case GramaticaParser.MAYOR_IGUAL:
return bool >= bool1;
default:
throw new RuntimeException("unknown operator: " + GramaticaParser.tokenNames[ctx.operacion.getType()]);
}
return 0;
}
Valora esta pregunta


0