From 47e6f6f55208d749fc8071288ec5ca36b1be8045 Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Wed, 9 Sep 2009 20:57:08 +0000 Subject: [PATCH] Now that we have explicit Ln() and Log10(), let's get rid of the hopelessly esoteric arbitrary-base Log(). --- src/java/com/samskivert/depot/Funcs.java | 16 ++-------------- .../samskivert/depot/function/NumericalFun.java | 15 --------------- .../com/samskivert/depot/impl/BuildVisitor.java | 6 ------ .../depot/impl/ExpressionEvaluator.java | 6 ------ .../samskivert/depot/impl/ExpressionVisitor.java | 2 -- 5 files changed, 2 insertions(+), 43 deletions(-) diff --git a/src/java/com/samskivert/depot/Funcs.java b/src/java/com/samskivert/depot/Funcs.java index 1cfdecc..e42cf21 100644 --- a/src/java/com/samskivert/depot/Funcs.java +++ b/src/java/com/samskivert/depot/Funcs.java @@ -68,8 +68,7 @@ public class Funcs } /** - * Creates an expression that computes the natural logarithm of the supplied expression, - * which may be double-precision. + * Creates an expression that computes the natural logarithm of the supplied expression. */ public static Ln ln (SQLExpression exp) { @@ -77,24 +76,13 @@ public class Funcs } /** - * Creates an expression that computes the base-10 logarithm of the supplied expression, - * which may be double-precision. + * Creates an expression that computes the base-10 logarithm of the supplied expression. */ public static Log10 log10 (SQLExpression value) { return new Log10(value); } - /** - * Creates an expression that computes the logarithm of the supplied value expression - * in the supplied base expression. Note: Under PostgreSQL, this must evaluate to a simple - * numerical, not double precision. - */ - public static LogN logN (SQLExpression base, SQLExpression value) - { - return new LogN(base, value); - } - /** * Creates an expression that evaluates to the constant PI. */ diff --git a/src/java/com/samskivert/depot/function/NumericalFun.java b/src/java/com/samskivert/depot/function/NumericalFun.java index e3c9540..396dcab 100644 --- a/src/java/com/samskivert/depot/function/NumericalFun.java +++ b/src/java/com/samskivert/depot/function/NumericalFun.java @@ -79,21 +79,6 @@ public abstract class NumericalFun } } - public static class LogN extends TwoArgFun { - public LogN (SQLExpression base, SQLExpression value) { - super(base, value); - } - public Object accept (ExpressionVisitor visitor) { - return visitor.visit(this); - } - public SQLExpression getBase () { - return _arg1; - } - public SQLExpression getValue () { - return _arg2; - } - } - public static class Pi extends NoArgFun { public Object accept (ExpressionVisitor visitor) { return visitor.visit(this); diff --git a/src/java/com/samskivert/depot/impl/BuildVisitor.java b/src/java/com/samskivert/depot/impl/BuildVisitor.java index a20753e..33e3503 100644 --- a/src/java/com/samskivert/depot/impl/BuildVisitor.java +++ b/src/java/com/samskivert/depot/impl/BuildVisitor.java @@ -69,7 +69,6 @@ import com.samskivert.depot.function.NumericalFun.Exp; import com.samskivert.depot.function.NumericalFun.Floor; import com.samskivert.depot.function.NumericalFun.Ln; import com.samskivert.depot.function.NumericalFun.Log10; -import com.samskivert.depot.function.NumericalFun.LogN; import com.samskivert.depot.function.NumericalFun.Pi; import com.samskivert.depot.function.NumericalFun.Power; import com.samskivert.depot.function.NumericalFun.Random; @@ -623,11 +622,6 @@ public abstract class BuildVisitor implements ExpressionVisitor return appendFunctionCall("log", exp.getArg()); } - public Void visit (LogN exp) - { - return appendFunctionCall("log", exp.getBase(), exp.getValue()); - } - public Void visit (Pi exp) { return appendFunctionCall("PI"); diff --git a/src/java/com/samskivert/depot/impl/ExpressionEvaluator.java b/src/java/com/samskivert/depot/impl/ExpressionEvaluator.java index 26bfb69..8e798b3 100644 --- a/src/java/com/samskivert/depot/impl/ExpressionEvaluator.java +++ b/src/java/com/samskivert/depot/impl/ExpressionEvaluator.java @@ -58,7 +58,6 @@ import com.samskivert.depot.function.NumericalFun.Exp; import com.samskivert.depot.function.NumericalFun.Floor; import com.samskivert.depot.function.NumericalFun.Ln; import com.samskivert.depot.function.NumericalFun.Log10; -import com.samskivert.depot.function.NumericalFun.LogN; import com.samskivert.depot.function.NumericalFun.Pi; import com.samskivert.depot.function.NumericalFun.Power; import com.samskivert.depot.function.NumericalFun.Random; @@ -395,11 +394,6 @@ public class ExpressionEvaluator throw new IllegalArgumentException("Can't evaluate expression: " + exp); } - public Void visit (LogN exp) - { - throw new IllegalArgumentException("Can't evaluate expression: " + exp); - } - public Void visit (Pi exp) { throw new IllegalArgumentException("Can't evaluate expression: " + exp); diff --git a/src/java/com/samskivert/depot/impl/ExpressionVisitor.java b/src/java/com/samskivert/depot/impl/ExpressionVisitor.java index 98da311..962f407 100644 --- a/src/java/com/samskivert/depot/impl/ExpressionVisitor.java +++ b/src/java/com/samskivert/depot/impl/ExpressionVisitor.java @@ -52,7 +52,6 @@ import com.samskivert.depot.function.NumericalFun.Exp; import com.samskivert.depot.function.NumericalFun.Floor; import com.samskivert.depot.function.NumericalFun.Ln; import com.samskivert.depot.function.NumericalFun.Log10; -import com.samskivert.depot.function.NumericalFun.LogN; import com.samskivert.depot.function.NumericalFun.Pi; import com.samskivert.depot.function.NumericalFun.Power; import com.samskivert.depot.function.NumericalFun.Random; @@ -125,7 +124,6 @@ public interface ExpressionVisitor public T visit (Floor exp); public T visit (Ln exp); public T visit (Log10 exp); - public T visit (LogN exp); public T visit (Pi exp); public T visit (Power exp); public T visit (Random exp);