| 5 | import me.xdrop.fuzzywuzzy.ratios.SimpleRatio; |
| 6 | |
| 7 | public abstract class RatioAlgorithm extends BasicAlgorithm { |
| 8 | |
| 9 | private Ratio ratio; |
| 10 | |
| 11 | public RatioAlgorithm() { |
| 12 | super(); |
| 13 | this.ratio = new SimpleRatio(); |
| 14 | } |
| 15 | |
| 16 | public RatioAlgorithm(ToStringFunction<String> stringFunction) { |
| 17 | super(stringFunction); |
| 18 | } |
| 19 | |
| 20 | public RatioAlgorithm(Ratio ratio) { |
| 21 | super(); |
| 22 | this.ratio = ratio; |
| 23 | } |
| 24 | |
| 25 | |
| 26 | public RatioAlgorithm(ToStringFunction<String> stringFunction, Ratio ratio) { |
| 27 | super(stringFunction); |
| 28 | this.ratio = ratio; |
| 29 | } |
| 30 | |
| 31 | public abstract int apply(String s1, String s2, Ratio ratio, ToStringFunction<String> stringFunction); |
| 32 | |
| 33 | public RatioAlgorithm with(Ratio ratio) { |
| 34 | setRatio(ratio); |
| 35 | return this; |
| 36 | } |
| 37 | |
| 38 | public int apply(String s1, String s2, Ratio ratio) { |
| 39 | return apply(s1, s2, ratio, getStringFunction()); |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public int apply(String s1, String s2, ToStringFunction<String> stringFunction) { |
| 44 | return apply(s1, s2, getRatio(), stringFunction); |
| 45 | } |
| 46 | |
| 47 | public void setRatio(Ratio ratio) { |
| 48 | this.ratio = ratio; |
| 49 | } |
| 50 | |
| 51 | public Ratio getRatio() { |
| 52 | return ratio; |
| 53 | } |
| 54 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…