-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 将市场面板从 MarketData 分离封装至 MarketGUi, 增加商品分类过滤器
- Loading branch information
Showing
7 changed files
with
255 additions
and
166 deletions.
There are no files selected for viewing
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
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
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
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
23 changes: 23 additions & 0 deletions
23
src/main/java/com/blank038/servermarket/filter/impl/TypeFilterImpl.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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.blank038.servermarket.filter.impl; | ||
|
||
import com.blank038.servermarket.data.sale.SaleItem; | ||
import com.blank038.servermarket.filter.interfaces.ISaleFilter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Blank038 | ||
*/ | ||
public class TypeFilterImpl implements ISaleFilter { | ||
private final List<String> types = new ArrayList<>(); | ||
|
||
public TypeFilterImpl(List<String> keys) { | ||
this.types.addAll(keys); | ||
} | ||
|
||
@Override | ||
public boolean check(SaleItem saleItem) { | ||
return this.types.stream().anyMatch((s) -> saleItem.getSaleTypes().contains(s)); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
|
||
public interface ISaleFilter { | ||
|
||
boolean check(SaleItem itemStack); | ||
boolean check(SaleItem saleItem); | ||
} |
Oops, something went wrong.