From 2926e345fa4dcea66c9846f9c6b01471119b40ed Mon Sep 17 00:00:00 2001
From: Flowsqy <47575244+Flowsqy@users.noreply.github.com>
Date: Wed, 16 Feb 2022 16:02:38 +0100
Subject: [PATCH] Generify basic operators and conditions and merge 'and' &
'or' condition
---
.../hologram/calculation/Calculation.java | 69 +++++++++----------
.../condition/AbstractEqualityCondition.java | 35 +++++-----
.../hologram/condition/AndCondition.java | 40 -----------
.../hologram/condition/BooleanCondition.java | 15 ++--
.../condition/ComparisonCondition.java | 55 +++++++--------
.../config/hologram/condition/Condition.java | 5 +-
.../hologram/condition/LogicCondition.java | 62 +++++++++++++++++
.../hologram/condition/OrCondition.java | 40 -----------
.../hologram/condition/ReverseCondition.java | 15 ++--
.../hologram/provider/ConstantProvider.java | 10 ++-
.../config/hologram/provider/MapProvider.java | 35 +++++-----
.../provider/RequirementProvider.java | 10 ---
12 files changed, 171 insertions(+), 220 deletions(-)
delete mode 100644 plugin/src/main/java/de/epiceric/shopchest/config/hologram/condition/AndCondition.java
create mode 100644 plugin/src/main/java/de/epiceric/shopchest/config/hologram/condition/LogicCondition.java
delete mode 100644 plugin/src/main/java/de/epiceric/shopchest/config/hologram/condition/OrCondition.java
delete mode 100644 plugin/src/main/java/de/epiceric/shopchest/config/hologram/provider/RequirementProvider.java
diff --git a/plugin/src/main/java/de/epiceric/shopchest/config/hologram/calculation/Calculation.java b/plugin/src/main/java/de/epiceric/shopchest/config/hologram/calculation/Calculation.java
index 692bc89..5195bd1 100644
--- a/plugin/src/main/java/de/epiceric/shopchest/config/hologram/calculation/Calculation.java
+++ b/plugin/src/main/java/de/epiceric/shopchest/config/hologram/calculation/Calculation.java
@@ -1,26 +1,23 @@
package de.epiceric.shopchest.config.hologram.calculation;
-import de.epiceric.shopchest.config.hologram.HologramFormat;
-
-import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
/**
* Represents a hologram calculation
*/
-public interface Calculation {
+public interface Calculation
{
- double calculate(Map provider);
+ double calculate(P provider);
- abstract class AbstractCalculation implements Calculation {
+ abstract class AbstractCalculation implements Calculation
{
- protected final Function