From 14948846f5a60ea9377bed0ea2ba826d7c5bfd9f Mon Sep 17 00:00:00 2001 From: Jeffrey Han Date: Thu, 3 Sep 2015 21:00:02 -0500 Subject: [PATCH] Added star difficulty to conditional search filters. Signed-off-by: Jeffrey Han --- src/itdelatrisu/opsu/beatmap/BeatmapSet.java | 2 ++ src/itdelatrisu/opsu/beatmap/BeatmapSetList.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapSet.java b/src/itdelatrisu/opsu/beatmap/BeatmapSet.java index 2dccce09..85eecb9c 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapSet.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapSet.java @@ -155,6 +155,8 @@ public boolean matches(String type, String operator, float value) { case "hp": v = beatmap.HPDrainRate; break; case "bpm": v = beatmap.bpmMax; break; case "length": v = beatmap.endTime / 1000; break; + case "star": + case "stars": v = Math.round(beatmap.starRating * 100) / 100f; break; default: return false; } diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java b/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java index 35be4090..2ddce0e3 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java @@ -45,7 +45,7 @@ public class BeatmapSetList { /** Search pattern for conditional expressions. */ private static final Pattern SEARCH_CONDITION_PATTERN = Pattern.compile( - "(ar|cs|od|hp|bpm|length)(=|==|>|>=|<|<=)((\\d*\\.)?\\d+)" + "(ar|cs|od|hp|bpm|length|stars?)(=|==|>|>=|<|<=)((\\d*\\.)?\\d+)" ); /** List containing all parsed nodes. */