git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1175 f203690c-595d-4dc9-a70b-905162fa7fd2tags/jackcess-2.2.0
@@ -50,15 +50,12 @@ public class DefaultFunctions | |||
public static final FunctionLookup LOOKUP = new FunctionLookup() { | |||
public Function getFunction(String name) { | |||
return DefaultFunctions.getFunction(name); | |||
return FUNCS.get(DatabaseImpl.toLookupName(name)); | |||
} | |||
}; | |||
private DefaultFunctions() {} | |||
public static Function getFunction(String name) { | |||
return FUNCS.get(DatabaseImpl.toLookupName(name)); | |||
} | |||
public static abstract class BaseFunction implements Function | |||
{ |
@@ -35,7 +35,6 @@ import java.util.Set; | |||
import java.util.regex.Pattern; | |||
import java.util.regex.PatternSyntaxException; | |||
import com.healthmarketscience.jackcess.DatabaseBuilder; | |||
import com.healthmarketscience.jackcess.expr.EvalContext; | |||
import com.healthmarketscience.jackcess.expr.EvalException; | |||
import com.healthmarketscience.jackcess.expr.Expression; | |||
@@ -71,18 +70,6 @@ public class Expressionator | |||
public Function getExpressionFunction(String name); | |||
} | |||
public static final ParseContext DEFAULT_PARSE_CONTEXT = new ParseContext() { | |||
public TemporalConfig getTemporalConfig() { | |||
return TemporalConfig.US_TEMPORAL_CONFIG; | |||
} | |||
public SimpleDateFormat createDateFormat(String formatStr) { | |||
return DatabaseBuilder.createDateFormat(formatStr); | |||
} | |||
public Function getExpressionFunction(String name) { | |||
return DefaultFunctions.getFunction(name); | |||
} | |||
}; | |||
private enum WordType { | |||
OP, COMP, LOG_OP, CONST, SPEC_OP_PREFIX, DELIM; | |||
} | |||
@@ -414,10 +401,6 @@ public class Expressionator | |||
Value.Type resultType, | |||
ParseContext context) { | |||
if(context == null) { | |||
context = DEFAULT_PARSE_CONTEXT; | |||
} | |||
List<Token> tokens = trimSpaces( | |||
ExpressionTokenizer.tokenize(exprType, exprStr, context)); | |||
@@ -343,7 +343,8 @@ public class ExpressionatorTest extends TestCase | |||
private static void validateExpr(String exprStr, String debugStr, | |||
String cleanStr) { | |||
Expression expr = Expressionator.parse( | |||
Expressionator.Type.FIELD_VALIDATOR, exprStr, null, null); | |||
Expressionator.Type.FIELD_VALIDATOR, exprStr, null, | |||
new TestParseContext()); | |||
String foundDebugStr = expr.toDebugString(); | |||
if(foundDebugStr.startsWith("<EImplicitCompOp>")) { | |||
assertEquals("<EImplicitCompOp>{<EThisValue>{<THIS_COL>} = " + | |||
@@ -381,7 +382,8 @@ public class ExpressionatorTest extends TestCase | |||
private static Boolean evalCondition(String exprStr, String thisVal) { | |||
Expression expr = Expressionator.parse( | |||
Expressionator.Type.FIELD_VALIDATOR, exprStr, null, new TestParseContext()); | |||
Expressionator.Type.FIELD_VALIDATOR, exprStr, null, | |||
new TestParseContext()); | |||
return (Boolean)expr.eval(new TestEvalContext(BuiltinOperators.toValue(thisVal))); | |||
} | |||
@@ -410,7 +412,7 @@ public class ExpressionatorTest extends TestCase | |||
} | |||
public Function getExpressionFunction(String name) { | |||
return DefaultFunctions.getFunction(name); | |||
return DefaultFunctions.LOOKUP.getFunction(name); | |||
} | |||
} | |||