-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Deprecated StringProcessor #47
Conversation
Deprecated StringProcessor and replaced all occurrences with ToStringFunction<String>, which was implemented with 1.2.0 StringProcessor is now an abstract class, because the JDK 1.7 does not allow default methods in interfaces, which would have been required for backwards compatibility. Also, NoProcess got deprecated and replaced with ToStringFunction.DEFAULT
Note that I am well aware of the junk-ness of making the StringProcessor processor = new StringProcessor() {
[...] After all, it is deprecated and should be replaced in the first place, but this will work in any case that does not use an implementing class. |
Nice one! Thanks for this. I also realised yesterdays changes (#46) break all
We could let the old ones be untyped (with a rather ugly cast):
Or preferably introduce another type eg. ( We could then merge the types when a new major version gets released, but until then let's not break backward compatibility. |
return this; | ||
} | ||
|
||
public BasicAlgorithm noProcessor(){ | ||
this.stringProcessor = new NoProcess(); | ||
this.stringFunction = ToStringFunction.DEFAULT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets replaced by DEFAULT
which I believe is not the same as NoProcess
, the basic ratios should not have any processing done to them by default, so we'd still need to have something that represents an identity string function input => input
for this usecase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NoProcess
just returned the unhandled input String, which is exactly what DEFAULT
does, so I fail to see a difference. 🤔 https://github.com/xdrop/fuzzywuzzy/pull/47/files#diff-a5cadeadf032c3e499ee1134add85c93L9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you got confused between ToStringFunction.DEFAULT
and DefaultStringFunction
?
The naming is odd on those ones.
What could be a better name for the final DEFAULT variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh my bad yeah got confused between those two. Maybe we should call it ToStringFunction.NO_PROCESS
or ToStringFunction.IDENTITY
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would go for "NO_PROCESS". will be contained in my next PR
It seems like you have forgot that every non-referring |
Oh welp, I have just realized the actual problem. Yea, sure. I agree on adding a different ExtractedResult item, what should its name be? i suggest Also, maybe you wanna make a branch "2.0" where we can form a new major release already |
I've made a branch 'develop' for the next major. You can push that for now though and I'll rename it later if I can think of anything better. |
i have changed the name to |
also im having the issue that i failed to remove the Deprecation commit before branching these changes. |
Nice, looking good - gonna keep this name. |
Deprecated
StringProcessor
and replaced all occurrences withToStringFunction<String>
, which was implemented with 1.2.0, because it is basically a more ""primitive"" implementation and theoretically a duplicate.StringProcessor
is now an abstract class, because the JDK 1.7 does not allow default methods in interfaces, which would have been required for backwards compatibility. That way,StringProcessor
can implementToStringFunction<String>
and overrideapply(T)
to overloadprocess(String)
.NoProcess
got deprecated and replaced withToStringFunction.DEFAULT
DefaultStringProcessor
got deprecated so that people switch to the properly namedDefaultStringFunction