summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/rpn/operations.go6
-rw-r--r--internal/rpn/operations_interfaces.go13
2 files changed, 15 insertions, 4 deletions
diff --git a/internal/rpn/operations.go b/internal/rpn/operations.go
index a3d660c..ca57a42 100644
--- a/internal/rpn/operations.go
+++ b/internal/rpn/operations.go
@@ -19,8 +19,10 @@ type Operations struct {
// Ensure Operations implements all operator sub-interfaces at compile time.
var (
- _ ArithmeticOperator = (*Operations)(nil)
- _ BooleanOperator = (*Operations)(nil)
+ _ ArithmeticOperator = (*Operations)(nil)
+ _ LogarithmicOperator = (*Operations)(nil)
+ _ MetricOperator = (*Operations)(nil)
+ _ BooleanOperator = (*Operations)(nil)
_ HyperOperator = (*Operations)(nil)
_ StackOperator = (*Operations)(nil)
_ VariableOperator = (*Operations)(nil)
diff --git a/internal/rpn/operations_interfaces.go b/internal/rpn/operations_interfaces.go
index 5acce62..6a543b9 100644
--- a/internal/rpn/operations_interfaces.go
+++ b/internal/rpn/operations_interfaces.go
@@ -11,9 +11,17 @@ type ArithmeticOperator interface {
Divide(stack *Stack) error
Power(stack *Stack) error
Modulo(stack *Stack) error
+}
+
+// LogarithmicOperator defines the interface for logarithmic operators.
+type LogarithmicOperator interface {
Log2(stack *Stack) error
Log10(stack *Stack) error
Ln(stack *Stack) error
+}
+
+// MetricOperator defines the interface for metric unit conversion.
+type MetricOperator interface {
Convert(stack *Stack) error
}
@@ -69,8 +77,9 @@ type PowerIntOperator interface {
}
// Operator implementations are split across focused sub-interfaces
-// (ArithmeticOperator, BooleanOperator, HyperOperator, StackOperator,
-// VariableOperator, ConstantOperator, PowerIntOperator) for clarity.
+// (ArithmeticOperator, LogarithmicOperator, MetricOperator, BooleanOperator,
+// HyperOperator, StackOperator, VariableOperator, ConstantOperator,
+// PowerIntOperator) for clarity.
// The combined Operator interface was removed — RPN is the sole client
// and Operations is the sole implementor, so the interface added
// indirection without practical benefit (ISP).