Skip to content
This repository was archived by the owner on Oct 8, 2022. It is now read-only.

Commit

Permalink
Rename statute benefits to side effects (#26)
Browse files Browse the repository at this point in the history
Co-authored-by: Diogo Correia <[email protected]>
  • Loading branch information
RafDevX and diogotcorreia authored Nov 12, 2021
1 parent e6bd927 commit ccb4c59
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions ggc-core/src/ggc/partners/ElitePartnerStatute.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public double calculateAdjustedValue(SaleTransaction saleTransaction,
}

@Override
public double applySaleBenefits(SaleTransaction saleTransaction, int date) {
public double applySaleSideEffects(SaleTransaction saleTransaction, int date) {
final int delta = date - saleTransaction.getPaymentDeadline();
final double adjusted = this.calculateAdjustedValue(saleTransaction, date);
if (delta < 0) { // on time
Expand All @@ -54,11 +54,11 @@ public double applySaleBenefits(SaleTransaction saleTransaction, int date) {
}

@Override
public void applyBreakdownBenefits(
public void applyBreakdownSideEffects(
BreakdownTransaction breakdownTransaction, int date) {
final double value = breakdownTransaction.baseValue();
if (value > 0) {
this.increasePoints(Math.round(10 * breakdownTransaction.baseValue()));
this.increasePoints(Math.round(10 * value));
}
}
}
6 changes: 3 additions & 3 deletions ggc-core/src/ggc/partners/NormalPartnerStatute.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public double calculateAdjustedValue(SaleTransaction saleTransaction,
}

@Override
public double applySaleBenefits(SaleTransaction saleTransaction, int date) {
public double applySaleSideEffects(SaleTransaction saleTransaction, int date) {
final int delta = date - saleTransaction.getPaymentDeadline();
final double adjusted = this.calculateAdjustedValue(saleTransaction, date);
if (delta < 0) { // on time
Expand All @@ -55,11 +55,11 @@ public double applySaleBenefits(SaleTransaction saleTransaction, int date) {
}

@Override
public void applyBreakdownBenefits(
public void applyBreakdownSideEffects(
BreakdownTransaction breakdownTransaction, int date) {
final double value = breakdownTransaction.baseValue();
if (value > 0) {
this.increasePoints(Math.round(10 * breakdownTransaction.baseValue()));
this.increasePoints(Math.round(10 * value));
this.tryForPromotion();
}
}
Expand Down
12 changes: 6 additions & 6 deletions ggc-core/src/ggc/partners/Partner.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public double calculateAdjustedValue(
return this.statute.calculateAdjustedValue(saleTransaction, date);
}

public double applySaleBenefits(SaleTransaction saleTransaction,
public double applySaleSideEffects(SaleTransaction saleTransaction,
int date) {
return this.statute.applySaleBenefits(saleTransaction, date);
return this.statute.applySaleSideEffects(saleTransaction, date);
}

public void applyBreakdownBenefits(
public void applyBreakdownSideEffects(
BreakdownTransaction breakdownTransaction, int date) {
this.statute.applyBreakdownBenefits(breakdownTransaction, date);
this.statute.applyBreakdownSideEffects(breakdownTransaction, date);
}

public void increaseAcquisitionsValue(double value) {
Expand Down Expand Up @@ -184,10 +184,10 @@ public abstract double calculateAdjustedValue(
SaleTransaction saleTransaction,
int date);

public abstract double applySaleBenefits(SaleTransaction saleTransaction,
public abstract double applySaleSideEffects(SaleTransaction saleTransaction,
int date);

public abstract void applyBreakdownBenefits(
public abstract void applyBreakdownSideEffects(
BreakdownTransaction breakdownTransaction, int date);

}
Expand Down
6 changes: 3 additions & 3 deletions ggc-core/src/ggc/partners/SelectionPartnerStatute.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public double calculateAdjustedValue(SaleTransaction saleTransaction,
}

@Override
public double applySaleBenefits(SaleTransaction saleTransaction, int date) {
public double applySaleSideEffects(SaleTransaction saleTransaction, int date) {
final int delta = date - saleTransaction.getPaymentDeadline();
final double adjusted = this.calculateAdjustedValue(saleTransaction, date);
if (delta < 0) { // on time
Expand All @@ -59,11 +59,11 @@ public double applySaleBenefits(SaleTransaction saleTransaction, int date) {
}

@Override
public void applyBreakdownBenefits(
public void applyBreakdownSideEffects(
BreakdownTransaction breakdownTransaction, int date) {
final double value = breakdownTransaction.baseValue();
if (value > 0) {
this.increasePoints(Math.round(10 * breakdownTransaction.baseValue()));
this.increasePoints(Math.round(10 * value));
this.tryForPromotion();
}
}
Expand Down
2 changes: 1 addition & 1 deletion ggc-core/src/ggc/products/DerivedProduct.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void buildFromRecipe(int quantity, Partner partner)
.reduce(Double::sum)
.orElse(0D);
}
batchPrice += batchPrice * this.getRecipe().getAggravatingFactor();
batchPrice *= 1 + this.getRecipe().getAggravatingFactor();
this.registerBatch(1, batchPrice, partner);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ggc-core/src/ggc/transactions/BreakdownTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public BreakdownTransaction(int id, int date, double value, int quantity,
Collection<Batch> resultingBatches) {
super(id, value, quantity, product, partner);
this.resultingBatches.addAll(resultingBatches);
this.getPartner().applyBreakdownBenefits(this, date);
this.getPartner().applyBreakdownSideEffects(this, date);
this.setPaymentDate(date);
}

Expand Down
2 changes: 1 addition & 1 deletion ggc-core/src/ggc/transactions/SaleTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public SaleTransaction(int id, double value, int quantity, Product product,
}

public void pay(int date) {
this.adjustedValue = this.getPartner().applySaleBenefits(this, date);
this.adjustedValue = this.getPartner().applySaleSideEffects(this, date);
this.setPaymentDate(date);
}

Expand Down

0 comments on commit ccb4c59

Please sign in to comment.