Traffic simulation patch
This commit is contained in:
parent
a35eea8878
commit
91c809e05c
22 changed files with 1595 additions and 83 deletions
|
|
@ -12,6 +12,7 @@ final class BExpression
|
|||
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 GREATER_EXP = 24;
|
||||
|
||||
private static final int SWITCH_EXP = 30;
|
||||
private static final int ASSIGN_EXP = 31;
|
||||
|
|
@ -105,6 +106,10 @@ final class BExpression
|
|||
{
|
||||
exp.typ = EQUAL_EXP;
|
||||
}
|
||||
else if ( "greater".equals( operator ) )
|
||||
{
|
||||
exp.typ = GREATER_EXP;
|
||||
}
|
||||
else
|
||||
{
|
||||
nops = 1; // check unary expressions
|
||||
|
|
@ -226,6 +231,7 @@ final class BExpression
|
|||
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 GREATER_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 );
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ package btools.expressions;
|
|||
public final class BExpressionContextWay extends BExpressionContext
|
||||
{
|
||||
private static String[] buildInVariables =
|
||||
{ "costfactor", "turncost", "uphillcostfactor", "downhillcostfactor", "initialcost", "nodeaccessgranted", "initialclassifier" };
|
||||
{ "costfactor", "turncost", "uphillcostfactor", "downhillcostfactor", "initialcost", "nodeaccessgranted", "initialclassifier", "trafficsourcedensity", "istrafficbackbone" };
|
||||
|
||||
protected String[] getBuildInVariableNames()
|
||||
{
|
||||
|
|
@ -25,6 +25,8 @@ public final class BExpressionContextWay extends BExpressionContext
|
|||
public float getInitialcost() { return getBuildInVariable(4); }
|
||||
public float getNodeAccessGranted() { return getBuildInVariable(5); }
|
||||
public float getInitialClassifier() { return getBuildInVariable(6); }
|
||||
public float getTrafficSourceDensity() { return getBuildInVariable(7); }
|
||||
public float getIsTrafficBackbone() { return getBuildInVariable(8); }
|
||||
|
||||
|
||||
public BExpressionContextWay( BExpressionMetaData meta )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue