explicit classifier for initial cost

This commit is contained in:
Arndt 2015-04-03 13:39:38 +02:00
parent 3ed62bb2b3
commit 0316c41924
4 changed files with 25 additions and 12 deletions

View file

@ -11,6 +11,7 @@ final class BExpression
private static final int ADD_EXP = 20;
private static final int MULTIPLY_EXP = 21;
private static final int MAX_EXP = 22;
private static final int EQUAL_EXP = 23;
private static final int SWITCH_EXP = 30;
private static final int ASSIGN_EXP = 31;
@ -100,6 +101,10 @@ final class BExpression
{
exp.typ = MAX_EXP;
}
else if ( "equal".equals( operator ) )
{
exp.typ = EQUAL_EXP;
}
else
{
nops = 1; // check unary expressions
@ -220,6 +225,7 @@ final class BExpression
case ADD_EXP: return op1.evaluate(ctx) + op2.evaluate(ctx);
case MULTIPLY_EXP: return op1.evaluate(ctx) * op2.evaluate(ctx);
case MAX_EXP: return max( op1.evaluate(ctx), op2.evaluate(ctx) );
case EQUAL_EXP: return op1.evaluate(ctx) == op2.evaluate(ctx) ? 1.f : 0.f;
case SWITCH_EXP: return op1.evaluate(ctx) != 0.f ? op2.evaluate(ctx) : op3.evaluate(ctx);
case ASSIGN_EXP: return ctx.assign( variableIdx, op1.evaluate(ctx) );
case LOOKUP_EXP: return ctx.getLookupMatch( lookupNameIdx, lookupValueIdxArray );