8 #ifndef IMPCONTAINER_CONSECUTIVE_PAIR_CONTAINER_H
9 #define IMPCONTAINER_CONSECUTIVE_PAIR_CONTAINER_H
11 #include <IMP/container/container_config.h>
20 IMPCONTAINER_BEGIN_NAMESPACE
41 bool get_contains(
const ParticleIndexPair &p)
const {
42 if (!get_model()->get_has_attribute(key_, p[0]))
return false;
43 int ia= get_model()->get_attribute(key_, p[0]);
44 if (!get_model()->get_has_attribute(key_, p[1]))
return false;
45 int ib= get_model()->get_attribute(key_, p[1]);
46 return std::abs(ia-ib)==1;
52 for (
unsigned int i=1; i< ps_.size(); ++i) {
53 f->apply_index(get_model(),
54 ParticleIndexPair(ps_[i-1], ps_[i]));
59 std::string name=
"ConsecutivePairContainer%1%");
76 return cpc_->get_contains(pi);
94 static IntKey get_exclusive_key() {
95 static IntKey k(
"exclusive consecutive numbering");
98 static ObjectKey get_exclusive_object_key() {
99 static ObjectKey k(
"exclusive consecutive container");
102 static bool get_contains(
Model *m,
const ParticleIndexPair &pp) {
103 ObjectKey ok= ExclusiveConsecutivePairContainer::get_exclusive_object_key();
104 if (!m->get_has_attribute(ok, pp[0])
105 || !m->get_has_attribute(ok, pp[1]))
return false;
109 IntKey k= ExclusiveConsecutivePairContainer::get_exclusive_key();
112 return std::abs(ia-ib)==1;
119 for (
unsigned int i=1; i< ps_.size(); ++i) {
120 f->apply_index(get_model(),
121 ParticleIndexPair(ps_[i-1], ps_[i]));
127 std::string name=
"ExclusiveConsecutivePairContainer%1%");
140 return ExclusiveConsecutivePairContainer
141 ::get_contains(m, pi);
143 ModelObjectsTemp ret;
151 IMPCONTAINER_END_NAMESPACE