Skip to content

Commit

Permalink
precompile sequence regex for sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
RoanH committed Feb 24, 2020
1 parent e35760d commit bc214e5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion osuSkinChecker/src/me/roan/osuskinchecker/SoundFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.util.Deque;
import java.util.List;
import java.util.regex.Pattern;

import me.roan.osuskinchecker.ini.Version;

Expand All @@ -15,6 +16,10 @@
* @see SoundModel
*/
public final class SoundFilter extends Filter<File>{
/**
* Sequence regex.
*/
private static final Pattern SEQ_REGEX = Pattern.compile("-[0-9]+");

/**
* Constructs a new SoundFilter with the given
Expand All @@ -36,7 +41,7 @@ protected File matches(File file, String fn, Deque<String> path){
if(fn.length() == 0){
return file;
}else{
if(animatedDash && fn.matches("-[0-9]+")){
if(animatedDash && SEQ_REGEX.matcher(fn).matches()){
return file;
}else{
return null;
Expand Down

0 comments on commit bc214e5

Please sign in to comment.