From d255ace3e7fed078f362456fd6232b1d3cb1eed1 Mon Sep 17 00:00:00 2001 From: vvatanabe Date: Wed, 16 Aug 2023 13:02:24 +0900 Subject: [PATCH] style: format code and optimize imports in matchers.OmnibusMatcher --- .../zxcvbn/matchers/OmnibusMatcher.java | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/nulabinc/zxcvbn/matchers/OmnibusMatcher.java b/src/main/java/com/nulabinc/zxcvbn/matchers/OmnibusMatcher.java index 0cdc9f3..95a3a47 100644 --- a/src/main/java/com/nulabinc/zxcvbn/matchers/OmnibusMatcher.java +++ b/src/main/java/com/nulabinc/zxcvbn/matchers/OmnibusMatcher.java @@ -2,7 +2,6 @@ import com.nulabinc.zxcvbn.Context; import com.nulabinc.zxcvbn.Matcher; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -10,31 +9,30 @@ public class OmnibusMatcher extends BaseMatcher { - private final Map> dictionaryMap; - - public OmnibusMatcher(Context context, Map> dictionaries) { - super(context); - if (dictionaries == null) { - this.dictionaryMap = new HashMap<>(); - } else { - this.dictionaryMap = dictionaries; - } - } + private final Map> dictionaryMap; - @Override - public List execute(CharSequence password) { - List matchers = new ArrayList<>(); - matchers.add(new DictionaryMatcher(this.getContext(), dictionaryMap)); - matchers.add(new ReverseDictionaryMatcher(this.getContext(), dictionaryMap)); - matchers.add(new L33tMatcher(this.getContext(), dictionaryMap)); - matchers.add(new SpatialMatcher(this.getContext())); - matchers.add(new RepeatMatcher(this.getContext())); - matchers.add(new SequenceMatcher(this.getContext())); - matchers.add(new RegexMatcher(this.getContext())); - matchers.add(new DateMatcher(this.getContext())); - List matches = new ArrayList<>(); - for (Matcher matcher: matchers) matches.addAll(matcher.execute(password)); - return this.sorted(matches); + public OmnibusMatcher(Context context, Map> dictionaries) { + super(context); + if (dictionaries == null) { + this.dictionaryMap = new HashMap<>(); + } else { + this.dictionaryMap = dictionaries; } + } + @Override + public List execute(CharSequence password) { + List matchers = new ArrayList<>(); + matchers.add(new DictionaryMatcher(this.getContext(), dictionaryMap)); + matchers.add(new ReverseDictionaryMatcher(this.getContext(), dictionaryMap)); + matchers.add(new L33tMatcher(this.getContext(), dictionaryMap)); + matchers.add(new SpatialMatcher(this.getContext())); + matchers.add(new RepeatMatcher(this.getContext())); + matchers.add(new SequenceMatcher(this.getContext())); + matchers.add(new RegexMatcher(this.getContext())); + matchers.add(new DateMatcher(this.getContext())); + List matches = new ArrayList<>(); + for (Matcher matcher : matchers) matches.addAll(matcher.execute(password)); + return this.sorted(matches); + } }