/** * \file AllBipartitePairContainer.cpp \brief A list of ParticlePairs. * * This file is generated by a script (core/tools/make-container). * Do not edit directly. * * Copyright 2007-2010 IMP Inventors. AllBipartite rights reserved. * */ #include "IMP/container/AllBipartitePairContainer.h" #include #include #include #include #include #include IMPCONTAINER_BEGIN_NAMESPACE AllBipartitePairContainer ::AllBipartitePairContainer( SingletonContainer *a, SingletonContainer *b, bool): a_(a), b_(b){ } AllBipartitePairContainer ::AllBipartitePairContainer( SingletonContainer *a, SingletonContainer *b): a_(a), b_(b), deps_(new DependenciesScoreState(this), a->get_model()){ } PairContainerPair AllBipartitePairContainer::get_added_and_removed_containers() const { IMP_NEW(IMP::core::internal::DifferenceSingletonContainer, olda, (a_, a_->get_removed_container())); IMP_NEW(IMP::core::internal::DifferenceSingletonContainer, oldb, (b_, b_->get_removed_container())); Pointer removed = PairContainerSet::create_untracked_container(); { Pointer all = AllBipartitePairContainer ::create_untracked_container(a_->get_removed_container(), b_->get_removed_container()); removed->add_pair_container(all); Pointer leftr = AllBipartitePairContainer ::create_untracked_container(a_->get_removed_container(), oldb); removed->add_pair_container(leftr); Pointer rightr = AllBipartitePairContainer::create_untracked_container(olda, b_->get_removed_container()); removed->add_pair_container(rightr); } Pointer added = PairContainerSet::create_untracked_container(); { Pointer all =AllBipartitePairContainer ::create_untracked_container(a_->get_added_container(), b_->get_added_container()); added->add_pair_container(all); Pointer leftr = AllBipartitePairContainer ::create_untracked_container(a_->get_added_container(), oldb); added->add_pair_container(leftr); Pointer rightr = AllBipartitePairContainer ::create_untracked_container(olda, b_->get_added_container()); added->add_pair_container(rightr); } return PairContainerPair(added, removed); } unsigned int AllBipartitePairContainer::get_number_of_particle_pairs() const { return a_->get_number_of_particles()*b_->get_number_of_particles(); } ParticlePair AllBipartitePairContainer ::get_particle_pair(unsigned int i) const { unsigned int a= i%a_->get_number_of_particles(); unsigned int b= i/a_->get_number_of_particles(); return ParticlePair(a_->get_particle(a), b_->get_particle(b)); } bool AllBipartitePairContainer ::get_contains_particle_pair(const ParticlePair &p) const { return a_->get_contains_particle(p[0]) && b_->get_contains_particle(p[1]); } void AllBipartitePairContainer::do_show(std::ostream &out) const { IMP_CHECK_OBJECT(this); out << "container " << *a_ << " and " << *b_ << std::endl; } ParticlesTemp AllBipartitePairContainer::get_contained_particles() const { ParticlesTemp ret= a_->get_contained_particles(); ParticlesTemp b= b_->get_contained_particles(); ret.insert(ret.end(), b.begin(), b.end()); return ret; } bool AllBipartitePairContainer::get_contained_particles_changed() const { return a_->get_contained_particles_changed() || b_->get_contained_particles_changed(); } IMPCONTAINER_END_NAMESPACE