biojava/biojava — pull request #39 by ulyssecarion (2013-08-09 18:59:41+00:00)
Title: Simplify and optimize bonds for memory usage

`Bond` is simplified as follows:
* The `BondType` object (and all Javadoc references to it) is removed from `Bond`. It has not been removed from Biojava altogether, though.
* By default, creating a bond will add that bond to the passed `Atom`s. However, this does create some wacky-looking code; the code `new Bond(a, b, 1)` is not a no-op, despite appearances. Perhaps an alternative would be to make a static method of `Bond` called `Bond.makeBondBetween`, which under the hood would use this constructor.

To save memory, `Atom`s are created with an `ArrayList` of initial capacity 0, and after all bonds are created all atoms have their bond arrays trimmed to size.

I also tossed in a few changes to `PDBFileParser` even though those deserve to be in another pull request.
* I added a test case to `TestBond` that makes sure ligands get bonds too.
* `addIntraResidueBonds` now loops over `getAtomGroups` and filters out waters, which still keeps ligands. The previous implementation used `getSeqResGroups`.