lasarobotics / FTCLibrary

Generic function and autonomous library for the FTC Android Platform
MIT License
25 stars 14 forks source link

Make ButtonState an Enumerator #43

Closed treyshaffer closed 4 months ago

treyshaffer commented 8 years ago

This seems like an ideal place to implement an enumerator. Sure, we may be at qualifiers right now, but I think it would be a more logical set-up for future builds. Note: I haven't checked other dependent files and changed to follow this standard, I was just scrolling through and saw this during some down time.

smo-key commented 8 years ago

@BlurryZombie, that's a good idea.

We used integers instead of a constructed enum because of the dependencies in Controller and the MonkeyC classes - changing this would require calling .get() about a hundred times because these classes currently store button states as integers: doing so allows us to serialize them easily into a very compressed form in JSON like { du: 0, dd: 0.6, etc. }. This is equally possible with enums, but we'll have to test whether enums and ints truly serialize in the same way (my instinct is that they have similar, but not exactly identical, serializations.)