8 #ifndef IMPCONTAINER_CONSECUTIVE_PAIR_CONTAINER_H
9 #define IMPCONTAINER_CONSECUTIVE_PAIR_CONTAINER_H
11 #include <IMP/container/container_config.h>
17 #include <boost/unordered_map.hpp>
20 IMPCONTAINER_BEGIN_NAMESPACE
40 if (!get_model()->get_has_attribute(key_, p[0]))
return false;
41 int ia = get_model()->get_attribute(key_, p[0]);
42 if (!get_model()->get_has_attribute(key_, p[1]))
return false;
43 int ib = get_model()->get_attribute(key_, p[1]);
44 return std::abs(ia - ib) == 1;
48 virtual std::size_t do_get_contents_hash()
const IMP_OVERRIDE {
return 0; }
54 for (
unsigned int i = 1; i < ps_.size(); ++i) {
55 f->apply_index(get_model(),
61 std::string name =
"ConsecutivePairContainer%1%");
64 IMPCONTAINER_DEPRECATED_METHOD_DECL(2.5)
93 return cpc_->get_contains(pip);
114 static IntKey get_exclusive_key() {
115 static IntKey k(
"exclusive consecutive numbering");
118 static ObjectKey get_exclusive_object_key() {
119 static ObjectKey k(
"exclusive consecutive container");
122 static bool get_contains(
Model *m,
125 ExclusiveConsecutivePairContainer::get_exclusive_object_key();
126 bool has_eok_0 = m->get_has_attribute(ok, pp[0]);
127 bool has_eok_1= m->get_has_attribute(ok, pp[1]);
128 if ( !has_eok_0 || !has_eok_1 )
133 IntKey k = ExclusiveConsecutivePairContainer::get_exclusive_key();
136 return std::abs(ia - ib) == 1;
141 virtual std::size_t do_get_contents_hash()
const IMP_OVERRIDE {
return 0; }
155 for (
unsigned int i = 1; i < ps_.size(); ++i) {
156 f->apply_index(get_model(),
163 "ExclusiveConsecutivePairContainer%1%");
166 IMPCONTAINER_DEPRECATED_METHOD_DECL(2.5)
185 : PairPredicate(
"ExclusiveConsecutivePairFilter %1%") {}
190 return ExclusiveConsecutivePairContainer::get_contains(m, pip);
202 IMPCONTAINER_END_NAMESPACE
A shared container for Pairs.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pi) const
Macros for various classes.
A container for Singletons.
A class to store an fixed array of same-typed values.
void apply_generic(F *f) const
apply to each item in container
void apply_generic(F *f) const
apply to each item in container
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
A container which contains all consecutive particle pairs from an input list.
ParticlesTemp get_particles(Model *m, const ParticleIndexes &ps)
#define IMP_PAIR_CONTAINER_METHODS(Name)
Class for storing model, its restraints, constraints, and particles.
virtual void do_destroy()
A smart pointer to a ref-counted Object that is a class member.
Store a list of ParticleIndexPairs.
virtual int get_value_index(Model *m, const ParticleIndexPair &pip) const
Compute the predicate and the derivative if needed.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Abstract predicate function.
virtual int get_value_index(Model *, const ParticleIndexPair &pip) const
Compute the predicate and the derivative if needed.
virtual ParticleIndexPairs get_indexes() const =0
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pi) const
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
#define IMP_PAIR_PREDICATE_METHODS(Name)
Define extra the functions needed for a PairPredicate.
Various important functionality for implementing decorators.