brandon-patterson / chemist

A virtual lab assistant
MIT License
0 stars 0 forks source link

Add a molar mass calculator #32

Closed brandon-patterson closed 5 years ago

brandon-patterson commented 5 years ago

resolves #21

This is pretty straightforward. Most of the new lines of code are just adding the data for atomic weights. There's a visitor at the bottom that calculates molar mass. (Notice that we don't have to touch the Chemical class to add this new calculation! That's the nice side of the Visitor pattern.)

There's definitely a little weirdness in the visitor itself related to error handling and accumulation of the mass counter. I was forced to jump through some hoops to make the compiler happy. Feel free to ask for more details if you're curious!

zspatter commented 5 years ago

This was pretty straightforward, I didn't have much trouble tracing these changes. I ran into some trouble building the project (and running ElementTest again). I've got everything working now. I believe the config changes I made should allow me to build in the future without too much hassle.

brandon-patterson commented 5 years ago

Tests still work locally for me as well, merging this!