Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * BondList.cpp
- *
- * Created on: Oct 10, 2012
- * Author: jbirchfield
- */
- #include "BondList.h"
- #include "Atom.h"
- #include <algorithm>
- #include <deque>
- #include <iostream>
- using namespace std;
- BondList::BondList() {
- }
- BondList::~BondList() {
- //TODO does anything need to be deleted here? perhaps left or right?
- //delete(left);
- //delete(right);
- }
- //TODO why do I get an error if I put const in front of Bond&
- //TODO why is this never getting called?
- static bool sortBond(Bond _left, Bond _right) {
- std::cout<<"sorting"<<std::endl;
- Atom& first = _left.getLeftAtom();
- Atom& second = _right.getLeftAtom();
- return (first.getPosition() < second.getPosition());
- }
- bool BondList::isBondsRemaining() {
- return bonds.size() > 0;
- }
- void BondList::addBond(const Bond& _bond) {
- std::cout<<"About to sort"<<std::endl;
- sort(bonds.begin(), bonds.end(), &sortBond);
- bonds.push_back(_bond);
- }
- Bond& BondList::popBond() {
- Bond& bond = bonds.front();
- bonds.pop_front();
- // sort(bonds.begin(), bonds.end(), sortBond);
- return bond;
- }
Add Comment
Please, Sign In to add comment