Set default query predicate to always true
This commit is contained in:
@@ -28,7 +28,7 @@ import java.util.function.Predicate;
|
|||||||
|
|
||||||
public abstract class Query<EntityType, QueryType>
|
public abstract class Query<EntityType, QueryType>
|
||||||
{
|
{
|
||||||
protected Predicate<EntityType> predicate;
|
protected Predicate<EntityType> predicate = x -> true;
|
||||||
|
|
||||||
protected Query()
|
protected Query()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,10 @@ public class BankItemQuery extends WidgetItemQuery
|
|||||||
Collection<WidgetItem> widgetItems = getBankItems(client);
|
Collection<WidgetItem> widgetItems = getBankItems(client);
|
||||||
if (widgetItems != null)
|
if (widgetItems != null)
|
||||||
{
|
{
|
||||||
return widgetItems.stream().filter(Objects::nonNull).filter(predicate).toArray(WidgetItem[]::new);
|
return widgetItems.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(predicate)
|
||||||
|
.toArray(WidgetItem[]::new);
|
||||||
}
|
}
|
||||||
return new WidgetItem[0];
|
return new WidgetItem[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ public class DecorativeObjectQuery extends TileObjectQuery<DecorativeObject, Dec
|
|||||||
@Override
|
@Override
|
||||||
public DecorativeObject[] result(Client client)
|
public DecorativeObject[] result(Client client)
|
||||||
{
|
{
|
||||||
return getDecorativeObjects(client).stream().filter(Objects::nonNull).filter(predicate).toArray(DecorativeObject[]::new);
|
return getDecorativeObjects(client).stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(predicate)
|
||||||
|
.toArray(DecorativeObject[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<DecorativeObject> getDecorativeObjects(Client client)
|
private Collection<DecorativeObject> getDecorativeObjects(Client client)
|
||||||
|
|||||||
@@ -70,7 +70,10 @@ public class EquipmentItemQuery extends WidgetItemQuery
|
|||||||
Collection<WidgetItem> widgetItems = getEquippedItems(client);
|
Collection<WidgetItem> widgetItems = getEquippedItems(client);
|
||||||
if (widgetItems != null)
|
if (widgetItems != null)
|
||||||
{
|
{
|
||||||
return widgetItems.stream().filter(Objects::nonNull).filter(predicate).toArray(WidgetItem[]::new);
|
return widgetItems.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(predicate)
|
||||||
|
.toArray(WidgetItem[]::new);
|
||||||
}
|
}
|
||||||
return new WidgetItem[0];
|
return new WidgetItem[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ public class GameObjectQuery extends TileObjectQuery<GameObject, GameObjectQuery
|
|||||||
@Override
|
@Override
|
||||||
public GameObject[] result(Client client)
|
public GameObject[] result(Client client)
|
||||||
{
|
{
|
||||||
return getGameObjects(client).stream().filter(Objects::nonNull).filter(predicate).toArray(GameObject[]::new);
|
return getGameObjects(client).stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(predicate)
|
||||||
|
.toArray(GameObject[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<GameObject> getGameObjects(Client client)
|
private Collection<GameObject> getGameObjects(Client client)
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ public class GroundObjectQuery extends TileObjectQuery<GroundObject, GroundObjec
|
|||||||
@Override
|
@Override
|
||||||
public GroundObject[] result(Client client)
|
public GroundObject[] result(Client client)
|
||||||
{
|
{
|
||||||
return getGroundObjects(client).stream().filter(Objects::nonNull).filter(predicate).toArray(GroundObject[]::new);
|
return getGroundObjects(client).stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(predicate)
|
||||||
|
.toArray(GroundObject[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<GroundObject> getGroundObjects(Client client)
|
private Collection<GroundObject> getGroundObjects(Client client)
|
||||||
|
|||||||
@@ -49,7 +49,10 @@ public class InventoryItemQuery extends WidgetItemQuery
|
|||||||
Collection<WidgetItem> widgetItems = getInventoryItems(client);
|
Collection<WidgetItem> widgetItems = getInventoryItems(client);
|
||||||
if (widgetItems != null)
|
if (widgetItems != null)
|
||||||
{
|
{
|
||||||
return widgetItems.stream().filter(Objects::nonNull).filter(predicate).toArray(WidgetItem[]::new);
|
return widgetItems.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(predicate)
|
||||||
|
.toArray(WidgetItem[]::new);
|
||||||
}
|
}
|
||||||
return new WidgetItem[0];
|
return new WidgetItem[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ public class ShopItemQuery extends WidgetItemQuery
|
|||||||
Collection<WidgetItem> widgetItems = getShopItems(client);
|
Collection<WidgetItem> widgetItems = getShopItems(client);
|
||||||
if (widgetItems != null)
|
if (widgetItems != null)
|
||||||
{
|
{
|
||||||
return widgetItems.stream().filter(Objects::nonNull).filter(predicate).toArray(WidgetItem[]::new);
|
return widgetItems.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(predicate)
|
||||||
|
.toArray(WidgetItem[]::new);
|
||||||
}
|
}
|
||||||
return new WidgetItem[0];
|
return new WidgetItem[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ public class WallObjectQuery extends TileObjectQuery<WallObject, WallObjectQuery
|
|||||||
@Override
|
@Override
|
||||||
public WallObject[] result(Client client)
|
public WallObject[] result(Client client)
|
||||||
{
|
{
|
||||||
return getWallObjects(client).stream().filter(Objects::nonNull).filter(predicate).toArray(WallObject[]::new);
|
return getWallObjects(client).stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(predicate)
|
||||||
|
.toArray(WallObject[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<WallObject> getWallObjects(Client client)
|
private Collection<WallObject> getWallObjects(Client client)
|
||||||
|
|||||||
Reference in New Issue
Block a user