Added more Javadocs

Javadocs, some optimizations to Ternary, and a gitignore for the
intellij workspace(everyone should have their own workspace)