| 4 | import me.xdrop.fuzzywuzzy.ToStringFunction; |
| 5 | |
| 6 | public abstract class BasicAlgorithm implements Applicable { |
| 7 | |
| 8 | private ToStringFunction<String> stringFunction; |
| 9 | |
| 10 | public BasicAlgorithm() { |
| 11 | this.stringFunction = new DefaultStringFunction(); |
| 12 | } |
| 13 | |
| 14 | public BasicAlgorithm(ToStringFunction<String> stringFunction) { |
| 15 | this.stringFunction = stringFunction; |
| 16 | } |
| 17 | |
| 18 | public abstract int apply(String s1, String s2, ToStringFunction<String> stringProcessor); |
| 19 | |
| 20 | public int apply(String s1, String s2){ |
| 21 | |
| 22 | return apply(s1, s2, this.stringFunction); |
| 23 | |
| 24 | } |
| 25 | |
| 26 | public BasicAlgorithm with(ToStringFunction<String> stringFunction){ |
| 27 | setStringFunction(stringFunction); |
| 28 | return this; |
| 29 | } |
| 30 | |
| 31 | public BasicAlgorithm noProcessor(){ |
| 32 | this.stringFunction = ToStringFunction.NO_PROCESS; |
| 33 | return this; |
| 34 | } |
| 35 | |
| 36 | void setStringFunction(ToStringFunction<String> stringFunction){ |
| 37 | this.stringFunction = stringFunction; |
| 38 | } |
| 39 | |
| 40 | public ToStringFunction<String> getStringFunction() { |
| 41 | return stringFunction; |
| 42 | } |
| 43 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…