Team2168 / 2014_Main_Robot

Code for the 2014 FRC season.
Other
2 stars 1 forks source link

Vision #2

Closed wshclth closed 10 years ago

wshclth commented 10 years ago

Changed data to vectors. Added more comments. Extended subsystem class. Added a method called isHotTarget.

jcorcoran commented 10 years ago

Unfortunately j2me doesn't support generics. So the way you ate using the vector class won't work.

Look at how it is used in the ConstantBase class in the utils package.

Ore check the java doc: http://www.google.com/url?sa=t&source=web&cd=1&ved=0CCQQFjAA&url=http%3A%2F%2Fjcs.mobile-utopia.com%2Fjcs%2F18554_Vector.html&ei=o-njUs6CKsmusAT-sIGwAg&usg=AFQjCNEMsqlCjCzBaQ_grk-Qn0RXfdEiwA

jcorcoran commented 10 years ago

Also there are errors in this code. Make sure it compiles. You've got variable names that have typos.

wshclth commented 10 years ago

What are generics?

jcorcoran commented 10 years ago

It let's you write a class which has no predefined notion of the type it will be operating on. So when you created the Vector class and specified

you defined the type. But the actual code for the Vector class (in J2SE) has no notion that it will be used on Strings. The code for the class is generic: see java doc for j2se version of vector: http://docs.oracle.com/javase/7/docs/api/java/util/Vector.html The version of java we use on the crop doesn't support this feature of the java language. So all its methods are written assuming that the type Object is being passed in or returned. This isn't as safe an implementation because there's no way to prevent someone from putting a Double into your vector of Strings, later when you go to operate on the Double which you assume is a string, you could run into runtime errors. But since there's no generics, we have no choice but to use the older implementation of the Vector class. Sent from mobile. On Jan 25, 2014 12:03 PM, "Vittorio Papandrea" notifications@github.com wrote: > What are generics? > > — > Reply to this email directly or view it on GitHubhttps://github.com/Team2168/FRC2014_Main_Robot/pull/2#issuecomment-33293757 > .
jcorcoran commented 10 years ago

Closing this pull request. OBE