[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #17824 [metrics-lib]: switch on string instead of many if-else with String comparison
#17824: switch on string instead of many if-else with String comparison
-------------------------+--------------------------
Reporter: iwakeh | Owner: karsten
Type: enhancement | Status: accepted
Priority: Low | Milestone:
Component: metrics-lib | Version:
Severity: Minor | Resolution:
Keywords: | Actual Points:
Parent ID: #17822 | Points:
Sponsor: |
-------------------------+--------------------------
Comment (by iwakeh):
{{{startsWith()}} if-else-chains should also be changed to switch. The
startsWith() for parsing should not be necessary.
In DescriptorImpl it could be achieved by splitting the first line and use
the String after @type (if there is any) for the switch-stmt.
I also would suggest moving the version handling to the parser classes.
Some (like TorPerfResultImpl) verify the version anyway and could if need
arises handle several versions in future. Thus there is no need for
DescriptorImpl to check the versions.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/17824#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs