-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Refactor PriceCalculator with strategy pattern (#138)"
This reverts commit 04f48d7.
- Loading branch information
Showing
4 changed files
with
20 additions
and
40 deletions.
There are no files selected for viewing
7 changes: 1 addition & 6 deletions
7
src/main/java/com/github/hcsp/polymorphism/Discount95Strategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
package com.github.hcsp.polymorphism; | ||
|
||
public class Discount95Strategy extends DiscountStrategy { | ||
@Override | ||
public int discount(int price, User user) { | ||
return (int)(price * 0.95); | ||
} | ||
} | ||
public class Discount95Strategy {} |
7 changes: 1 addition & 6 deletions
7
src/main/java/com/github/hcsp/polymorphism/NoDiscountStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
package com.github.hcsp.polymorphism; | ||
|
||
public class NoDiscountStrategy extends DiscountStrategy { | ||
@Override | ||
public int discount(int price, User user) { | ||
return price; | ||
} | ||
} | ||
public class NoDiscountStrategy {} |
11 changes: 1 addition & 10 deletions
11
src/main/java/com/github/hcsp/polymorphism/OnlyVipDiscountStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
package com.github.hcsp.polymorphism; | ||
|
||
public class OnlyVipDiscountStrategy extends DiscountStrategy { | ||
@Override | ||
public int discount(int price, User user) { | ||
if (user.isVip()) { | ||
return (int)(price * 0.95); | ||
} else { | ||
return price; | ||
} | ||
} | ||
} | ||
public class OnlyVipDiscountStrategy {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters