/*
 * Project: MoleCuilder
 * Description: creates and alters molecular systems
 * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
 * 
 *
 *   This file is part of MoleCuilder.
 *
 *    MoleCuilder is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    MoleCuilder is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with MoleCuilder.  If not, see .
 */
/*
 * atom_bondedparticleinfo.cpp
 *
 *  Created on: Oct 19, 2009
 *      Author: heber
 */
// include config.h
#ifdef HAVE_CONFIG_H
#include 
#endif
#include "CodePatterns/MemDebug.hpp"
#include "CodePatterns/Assert.hpp"
#include "CodePatterns/Log.hpp"
#include "WorldTime.hpp"
#include "atom_bondedparticleinfo.hpp"
BondList BondedParticleInfo::emptyList;
/** Constructor of class BondedParticleInfo.
 */
BondedParticleInfo::BondedParticleInfo() :
  AdaptiveOrder(0),
  MaxOrder(0)
{}
/** Destructor of class BondedParticleInfo.
 */
BondedParticleInfo::~BondedParticleInfo()
{}
void BondedParticleInfo::AppendTrajectoryStep()
{
  ListOfBonds.push_back(BondList());
  LOG(5,"BondedParticleInfo::AppendTrajectoryStep() called, size is " << ListOfBonds.size());
}
const BondList& BondedParticleInfo::getListOfBonds() const
{
  if(WorldTime::getTime() < ListOfBonds.size())
    return ListOfBonds[WorldTime::getTime()];
  else
    return emptyList;
}
//BondList& BondedParticleInfo::getListOfBonds()
//{
//  // todo: here we actually need a container on whose destruction notifiy is emitted, i.e.
//  // similar or simply an ObservedContainer.
//  OBSERVE;
//  NOTIFY(AtomObservable::BondsAdded);
//  const unsigned int size = ListOfBonds.size();
//  ASSERT(WorldTime::getTime() <= size,
//      "BondedParticleInfo::getBondsAtStep() - Access out of range: "
//      +toString(WorldTime::getTime())
//      +" not in [0,"+toString(size)+"].");
//  if (WorldTime::getTime() == size) {
//    UpdateSteps();
//  }
//  return ListOfBonds[WorldTime::getTime()];
//}
const BondList& BondedParticleInfo::getListOfBondsAtStep(unsigned int _step) const
{
  if(_step < ListOfBonds.size())
    return ListOfBonds[_step];
  else
    return emptyList;
}
//BondList& BondedParticleInfo::getListOfBondsAtStep(unsigned int _step)
//{
//  const unsigned int size = ListOfBonds.size();
//  ASSERT(_step <= size,
//      "BondedParticleInfo::getBondsAtStep() - Access out of range: "
//      +toString(_step)
//      +" not in [0,"+toString(size)+"].");
//  if (_step == size) {
//    UpdateSteps();
//  }
//  return ListOfBonds[_step];
//}