59 lines
1.8 KiB
Java
59 lines
1.8 KiB
Java
// context for simple expression
|
|
// context means:
|
|
// - the local variables
|
|
// - the local variable names
|
|
// - the lookup-input variables
|
|
|
|
package btools.expressions;
|
|
|
|
import btools.codec.TagValueValidator;
|
|
|
|
|
|
|
|
public final class BExpressionContextWay extends BExpressionContext implements TagValueValidator
|
|
{
|
|
private static String[] buildInVariables =
|
|
{ "costfactor", "turncost", "uphillcostfactor", "downhillcostfactor", "initialcost", "nodeaccessgranted", "initialclassifier", "trafficsourcedensity", "istrafficbackbone" };
|
|
|
|
protected String[] getBuildInVariableNames()
|
|
{
|
|
return buildInVariables;
|
|
}
|
|
|
|
public float getCostfactor() { return getBuildInVariable(0); }
|
|
public float getTurncost() { return getBuildInVariable(1); }
|
|
public float getUphillCostfactor() { return getBuildInVariable(2); }
|
|
public float getDownhillCostfactor() { return getBuildInVariable(3); }
|
|
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 )
|
|
{
|
|
super( "way", meta );
|
|
}
|
|
|
|
/**
|
|
* Create an Expression-Context for way context
|
|
*
|
|
* @param hashSize size of hashmap for result caching
|
|
*/
|
|
public BExpressionContextWay( int hashSize, BExpressionMetaData meta )
|
|
{
|
|
super( "way", hashSize, meta );
|
|
}
|
|
|
|
@Override
|
|
public boolean accessAllowed( byte[] description )
|
|
{
|
|
evaluate( false, description, null );
|
|
boolean ok = getCostfactor() < 10000.;
|
|
evaluate( true, description, null );
|
|
ok |= getCostfactor() < 10000.;
|
|
return ok;
|
|
}
|
|
|
|
}
|