BALL
1.4.2
|
#include <BALL/CONCEPT/composite.h>
Classes | |
class | AncestorIteratorTraits |
class | ChildCompositeIteratorTraits |
class | CompositeIteratorTraits |
Public Member Functions | |
AncestorIterator | beginAncestor () |
AncestorIterator | endAncestor () |
AncestorConstIterator | beginAncestor () const |
AncestorConstIterator | endAncestor () const |
ChildCompositeIterator | beginChildComposite () |
ChildCompositeIterator | endChildComposite () |
ChildCompositeConstIterator | beginChildComposite () const |
ChildCompositeConstIterator | endChildComposite () const |
ChildCompositeReverseIterator | rbeginChildComposite () |
ChildCompositeReverseIterator | rendChildComposite () |
ChildCompositeConstReverseIterator | rbeginChildComposite () const |
ChildCompositeConstReverseIterator | rendChildComposite () const |
CompositeIterator | beginComposite () |
CompositeIterator | endComposite () |
CompositeConstIterator | beginComposite () const |
CompositeConstIterator | endComposite () const |
CompositeReverseIterator | rbeginComposite () |
CompositeReverseIterator | rendComposite () |
CompositeConstReverseIterator | rbeginComposite () const |
CompositeConstReverseIterator | rendComposite () const |
void | deleteChildrenList_ (std::list< Composite * > &composites) |
template<typename T > | |
BALL_INLINE bool | apply (UnaryProcessor< T > &processor) |
template<typename T > | |
BALL_INLINE T * | getAncestor (const T &) |
template<typename T > | |
BALL_INLINE const T * | getAncestor (const T &) const |
template<typename T > | |
BALL_INLINE T * | getPrevious (const T &) |
template<typename T > | |
BALL_INLINE const T * | getPrevious (const T &dummy) const |
template<typename T > | |
BALL_INLINE T * | getNext (const T &) |
template<typename T > | |
BALL_INLINE const T * | getNext (const T &dummy) const |
template<typename T > | |
BALL_INLINE bool | hasAncestor (const T &dummy) const |
Construction and Destruction | |
Composite () | |
Composite (const Composite &composite, bool deep=true) | |
virtual | ~Composite () |
virtual void | clear () |
virtual void | destroy () |
void | destroy (bool virtual_destroy) |
void * | clone (Composite &root) const |
Persistence | |
virtual void | persistentWrite (PersistenceManager &pm, const char *name=0) const |
virtual void | persistentRead (PersistenceManager &pm) |
Predicates | |
bool | operator== (const Composite &composite) const |
bool | operator!= (const Composite &composite) const |
bool | isEmpty () const |
bool | isRoot () const |
bool | isRootOf (const Composite &composite) const |
bool | isInterior () const |
bool | hasChild () const |
bool | isChildOf (const Composite &composite) const |
bool | isFirstChild () const |
bool | isFirstChildOf (const Composite &composite) const |
bool | isLastChild () const |
bool | isLastChildOf (const Composite &composite) const |
bool | hasParent () const |
bool | isParentOf (const Composite &composite) const |
bool | hasSibling () const |
bool | isSiblingOf (const Composite &composite) const |
bool | hasPreviousSibling () const |
bool | isPreviousSiblingOf (const Composite &composite) const |
bool | hasNextSibling () const |
bool | isNextSiblingOf (const Composite &composite) const |
bool | isDescendantOf (const Composite &composite) const |
template<typename T > | |
bool | hasAncestor (const T &dummy) const |
bool | isAncestorOf (const Composite &composite) const |
bool | isRelatedWith (const Composite &composite) const |
bool | isHomomorph (const Composite &composite) const |
bool | containsSelection () const |
Debugging and Diagnostics | |
virtual bool | isValid () const |
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
Application and Hosting | |
void | host (Visitor< Composite > &visitor) |
template<typename T > | |
bool | applyAncestor (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyChild (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyDescendantPreorder (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyDescendantPostorder (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyDescendant (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyPreorder (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyPostorder (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | apply (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyLevel (UnaryProcessor< T > &processor, long level) |
Public Member Functions inherited from BALL::PersistentObject | |
PersistentObject () | |
virtual | ~PersistentObject () |
PersistenceManager & | operator>> (PersistenceManager &pm) const |
virtual void | finalize () |
Public Member Functions inherited from BALL::Object | |
Object () | |
Default constructor. More... | |
Object (const Object &object) | |
Copy constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
const Object & | operator= (const Object &) |
bool | operator== (const Object &object) const |
bool | operator!= (const Object &object) const |
bool | operator< (const Object &object) const |
bool | operator<= (const Object &object) const |
bool | operator>= (const Object &object) const |
bool | operator> (const Object &object) const |
int | compare (const Object &object) const |
virtual void | dump (::std::ostream &s=std::cout, Size depth=0) const |
Handle | getHandle () const |
Public Member Functions inherited from BALL::AutoDeletable | |
virtual | ~AutoDeletable () |
void * | operator new (size_t size) |
void | operator delete (void *ptr) |
void * | operator new (size_t size, void *ptr) |
void | operator delete (void *ptr, void *) |
bool | isAutoDeletable () const |
void | setAutoDeletable (bool enable) |
Public Member Functions inherited from BALL::Selectable | |
Selectable () | |
Selectable (const Selectable &selectable, bool deep=true) | |
virtual | ~Selectable () |
void | set (const Selectable &selectable, bool deep=true) |
const Selectable & | operator= (const Selectable &selectable) |
void | get (Selectable &selectable, bool deep=true) const |
void | swap (Selectable &selectable) |
virtual void | setSelected (bool selected) |
bool | isSelected () const |
bool | operator== (const Selectable &selectable) const |
bool | operator!= (const Selectable &selectable) const |
void | write (PersistenceManager &pm) const |
bool | read (PersistenceManager &pm) |
virtual void | dump (::std::ostream &s=std::cout, Size depth=0) const |
Static Public Attributes | |
static UnaryProcessor< Composite > | DEFAULT_PROCESSOR |
static KernelPredicateType | DEFAULT_UNARY_PREDICATE |
Private Member Functions | |
Size | getHeight_ (Size size, Size &max_height) const |
Size | countDescendants_ () const |
void | clone_ (Composite &parent, Composite &stack) const |
template<typename T > | |
bool | applyLevelNostart_ (UnaryProcessor< T > &processor, long level) |
template<typename T > | |
bool | applyChildNostart_ (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyPreorderNostart_ (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyDescendantPreorderNostart_ (UnaryProcessor< T > &processor) |
template<typename T > | |
bool | applyDescendantPostorderNostart_ (UnaryProcessor< T > &processor) |
void | updateSelection_ () |
void | determineSelection_ () |
void | select_ (bool update_parent=true) |
void | deselect_ (bool update_parent=true) |
void | destroyChildren_ () |
Friends | |
class | AncestorIteratorTraits |
class | ChildCompositeIteratorTraits |
class | CompositeIteratorTraits |
Modifying and Accessing the Tree | |
void | set (const Composite &composite, bool deep=true) |
Composite & | operator= (const Composite &composite) |
void | get (Composite &composite, bool deep=true) const |
Size | getDegree () const |
Size | count (const KernelPredicateType &predicate) const |
Size | countDescendants () const |
Size | getPathLength (const Composite &composite) const |
Size | getDepth () const |
Size | getHeight () const |
Composite & | getRoot () |
const Composite & | getRoot () const |
Composite * | getLowestCommonAncestor (const Composite &composite) |
const Composite * | getLowestCommonAncestor (const Composite &composite) const |
template<typename T > | |
T * | getAncestor (const T &) |
template<typename T > | |
const T * | getAncestor (const T &) const |
template<typename T > | |
T * | getPrevious (const T &) |
template<typename T > | |
const T * | getPrevious (const T &dummy) const |
template<typename T > | |
T * | getNext (const T &) |
template<typename T > | |
const T * | getNext (const T &dummy) const |
Composite * | getParent () |
const Composite * | getParent () const |
Composite * | getChild (Index index) |
const Composite * | getChild (Index index) const |
Composite * | getSibling (Index index) |
const Composite * | getSibling (Index index) const |
Composite * | getFirstChild () |
const Composite * | getFirstChild () const |
Composite * | getLastChild () |
const Composite * | getLastChild () const |
const PreciseTime & | getModificationTime () const |
const PreciseTime & | getSelectionTime () const |
void | stamp (StampType stamp=BOTH) |
void | prependChild (Composite &composite) |
void | appendChild (Composite &composite) |
void | insertBefore (Composite &composite) |
void | insertAfter (Composite &composite) |
void | spliceBefore (Composite &composite) |
void | spliceAfter (Composite &composite) |
void | splice (Composite &composite) |
bool | removeChild (Composite &child) |
Size | removeSelected () |
Size | removeUnselected () |
void | replace (Composite &composite) |
void | swap (Composite &composite) |
virtual void | select () |
virtual void | deselect () |
static bool | insertParent (Composite &parent, Composite &first, Composite &last, bool destroy_parent=true) |
Additional Inherited Members | |
Static Public Member Functions inherited from BALL::Object | |
static Handle | getNextHandle () |
static Handle | getNewHandle () |
Static Public Member Functions inherited from BALL::AutoDeletable | |
static void | clearLastPtr () |
Protected Member Functions inherited from BALL::AutoDeletable | |
AutoDeletable () | |
AutoDeletable (const AutoDeletable &auto_deletable, bool deep=false) | |
Protected Attributes inherited from BALL::Selectable | |
bool | selected_ |
Composite Class. This class implements a variant of the composite design pattern. A Composite may contain an arbitrary number of other composites, thus forming a tree. All BALL kernel classes are derived from Composite. This provides a unique interface for all kernel classes.
Definition at line 69 of file composite.h.
typedef ConstForwardIterator<Composite, Composite, Composite*, AncestorIteratorTraits> BALL::Composite::AncestorConstIterator |
Definition at line 944 of file composite.h.
typedef ForwardIterator<Composite, Composite, Composite*, AncestorIteratorTraits> BALL::Composite::AncestorIterator |
Definition at line 931 of file composite.h.
typedef ConstBidirectionalIterator<Composite, Composite, Composite *, ChildCompositeIteratorTraits> BALL::Composite::ChildCompositeConstIterator |
Definition at line 1068 of file composite.h.
typedef std::reverse_iterator<ChildCompositeConstIterator> BALL::Composite::ChildCompositeConstReverseIterator |
Definition at line 1098 of file composite.h.
typedef BidirectionalIterator<Composite, Composite, Composite *, ChildCompositeIteratorTraits> BALL::Composite::ChildCompositeIterator |
Definition at line 1051 of file composite.h.
typedef std::reverse_iterator<ChildCompositeIterator> BALL::Composite::ChildCompositeReverseIterator |
Definition at line 1084 of file composite.h.
typedef ConstBidirectionalIterator<Composite, Composite, Composite*, CompositeIteratorTraits> BALL::Composite::CompositeConstIterator |
Definition at line 1355 of file composite.h.
typedef std::reverse_iterator<CompositeConstIterator> BALL::Composite::CompositeConstReverseIterator |
Definition at line 1381 of file composite.h.
typedef BidirectionalIterator<Composite, Composite, Composite*, CompositeIteratorTraits> BALL::Composite::CompositeIterator |
Definition at line 1348 of file composite.h.
typedef std::reverse_iterator<CompositeIterator> BALL::Composite::CompositeReverseIterator |
Definition at line 1368 of file composite.h.
Composite predicate type. This type declares a predicate operating on composites. As it is used as a predicate for all kernel classes, it is named KernelPredicateType.
Definition at line 86 of file composite.h.
BALL::Composite::Composite | ( | ) |
Default constructor. This constructor creates an empty composite object.
Copy constructor. Creates a copy of a composite. Deep copies include the whole composite tree, shallow copies contain anly a single composite.
composite | the composite to be cloned (the root of the tree in the case of a deep copy) |
deep | make a deep copy (true) or shallow copy (false) |
|
virtual |
Destructor. The destructor calls destroy to remove the composite from potential tree structures. It also recursively destructs all children of the composite.
void BALL::Composite::appendChild | ( | Composite & | composite | ) |
Insert a composite as the last child of this composite. Updates the modification time stamp. Note that this method alters the composite tree from which composite
is taken, if there is such a tree.
composite | the composite to be inserted |
bool BALL::Composite::apply | ( | UnaryProcessor< T > & | processor | ) |
Apply a processor to the node and its subtree. applyPreorder is used.
Exception::GeneralException |
BALL_INLINE bool BALL::Composite::apply | ( | UnaryProcessor< T > & | processor | ) |
Definition at line 1679 of file composite.h.
bool BALL::Composite::applyAncestor | ( | UnaryProcessor< T > & | processor | ) |
Apply a processor to all ancestors of this node.
Exception::GeneralException |
Definition at line 1455 of file composite.h.
bool BALL::Composite::applyChild | ( | UnaryProcessor< T > & | processor | ) |
Apply a processor to all children of this node.
Exception::GeneralException |
Definition at line 1481 of file composite.h.
|
private |
Definition at line 1487 of file composite.h.
bool BALL::Composite::applyDescendant | ( | UnaryProcessor< T > & | processor | ) |
Apply a processor to all descendents of this node. The node itself is not processed. applyDescendantPreorder is used.
Exception::GeneralException |
Definition at line 1666 of file composite.h.
bool BALL::Composite::applyDescendantPostorder | ( | UnaryProcessor< T > & | processor | ) |
Apply a processor to all descendents of this node. The node itself is not processed. The root of a subtree is accessed after the nodes in its left and right subtree.
Exception::GeneralException |
Definition at line 1543 of file composite.h.
|
private |
Definition at line 1549 of file composite.h.
bool BALL::Composite::applyDescendantPreorder | ( | UnaryProcessor< T > & | processor | ) |
Apply a processor to all descendents of this node. The node itself is not processed. The root of a subtree is accessed before the nodes in its left and right subtree.
Exception::GeneralException |
Definition at line 1509 of file composite.h.
|
private |
Definition at line 1515 of file composite.h.
bool BALL::Composite::applyLevel | ( | UnaryProcessor< T > & | processor, |
long | level | ||
) |
Apply a processor to the node and its siblings.
Exception::GeneralException |
Definition at line 1593 of file composite.h.
|
private |
Definition at line 1599 of file composite.h.
bool BALL::Composite::applyPostorder | ( | UnaryProcessor< T > & | processor | ) |
Apply a processor to the node and its subtree. The root of a subtree is accessed after the nodes in its left and right subtree.
Exception::GeneralException |
Definition at line 1578 of file composite.h.
bool BALL::Composite::applyPreorder | ( | UnaryProcessor< T > & | processor | ) |
Apply a processor to the node and its subtree. The root of a subtree is accessed before the nodes in its left and right subtree.
Exception::GeneralException |
Definition at line 1672 of file composite.h.
|
private |
Definition at line 1639 of file composite.h.
|
inline |
Definition at line 933 of file composite.h.
|
inline |
Definition at line 946 of file composite.h.
|
inline |
Definition at line 1053 of file composite.h.
|
inline |
Definition at line 1070 of file composite.h.
|
inline |
Definition at line 1350 of file composite.h.
|
inline |
Definition at line 1357 of file composite.h.
|
virtual |
Clear the composite properties. This method removes the composite's children and destructs them if they are auto-deletable.
this
. Reimplemented from BALL::Selectable.
Reimplemented in BALL::Atom, BALL::Bond, BALL::PDBAtom, BALL::Residue, BALL::Nucleotide, BALL::SecondaryStructure, BALL::AtomContainer, BALL::NucleicAcid, and BALL::Protein.
void* BALL::Composite::clone | ( | Composite & | root | ) | const |
Clone with a predicate. This method copies the attributes of this
composite to root (shallow copy) and then adds recursively each of its children.
root | the cloning target root is destroy ed prior to any copying |
&root
) bool BALL::Composite::containsSelection | ( | ) | const |
Return true if any descendant is selected. This method does not check all nodes recursively. Instead, on each modification of the tree, internal flags are updated and the information is propagated upwards in the tree.
Size BALL::Composite::count | ( | const KernelPredicateType & | predicate | ) | const |
Count the number of nodes fulfilling a predicate in this subtree.
predicate | the predicate |
Size BALL::Composite::countDescendants | ( | ) | const |
Count the number of descendants.
|
private |
void BALL::Composite::deleteChildrenList_ | ( | std::list< Composite * > & | composites | ) |
|
virtual |
Deselect a composite. This method deselects the composite and all the composites therein.
Reimplemented from BALL::Selectable.
|
private |
|
virtual |
Destroy the composite. This method removes the composite from potential parental structures and then calls clear to destruct all children.
this
. Reimplemented in BALL::Atom, BALL::Bond, BALL::PDBAtom, BALL::Residue, BALL::Nucleotide, BALL::AtomContainer, BALL::SecondaryStructure, BALL::NucleicAcid, and BALL::Protein.
void BALL::Composite::destroy | ( | bool | virtual_destroy | ) |
Non-virtual destroy method. This method behaves exactly like destroy except for a small difference: when called with true, it calls the virtual clear function. If called with false it calls the original clear function of Composite. This is useful when implementing the behaviour of derived classes.
this
. virtual_destroy | call the virtual clear method (true) or Composite::clear() (false) |
|
private |
|
private |
|
virtual |
Dump the constent of this instance to an ostream.
s | the stream to which we will dump |
depth | the indentation depth of the output |
Reimplemented in BALL::Atom, BALL::Bond, BALL::AtomContainer, BALL::Residue, BALL::Chain, BALL::SecondaryStructure, BALL::PDBAtom, BALL::Protein, BALL::Nucleotide, BALL::Molecule, BALL::NucleicAcid, and BALL::Fragment.
|
inline |
Definition at line 938 of file composite.h.
|
inline |
Definition at line 951 of file composite.h.
|
inline |
Definition at line 1059 of file composite.h.
|
inline |
Definition at line 1076 of file composite.h.
|
inline |
Definition at line 1352 of file composite.h.
|
inline |
Definition at line 1362 of file composite.h.
Assignment of a tree to another. Create a deep (deep
= true) or shallow copy of a composite and assign it to composite
. composite
is destroyed first.
composite | the composite to assign the copy to |
deep | true for a deep copy |
T* BALL::Composite::getAncestor | ( | const T & | ) |
Find the first ancestor of type T. This method walks up the tree from parent to parent and checks whether the composite object is a kind of T
. This method is useful to identify special container classes.
const T* BALL::Composite::getAncestor | ( | const T & | ) | const |
Find the first ancestor of type T (const method). This method operates also on constant trees.
BALL_INLINE T* BALL::Composite::getAncestor | ( | const T & | ) |
Definition at line 1686 of file composite.h.
BALL_INLINE const T* BALL::Composite::getAncestor | ( | const T & | ) | const |
Definition at line 1706 of file composite.h.
Return the index th child of this composite. If no such child exists, 0 is returned. The index of the first child is 0.
index | the index of the child to return |
Return a const pointer to the index th child of this composite. If no such child exists, 0 is returned. The index of the first child is 0.
index | the index of the child to return |
Size BALL::Composite::getDegree | ( | ) | const |
Return the degree of the node. This method returns the number of children of a composite object.
Size BALL::Composite::getDepth | ( | ) | const |
Get the depth of this item in its tree. The depth of a root item is 0.
Composite* BALL::Composite::getFirstChild | ( | ) |
Return a pointer to the first child.
const Composite* BALL::Composite::getFirstChild | ( | ) | const |
Return a const pointer to the first child.
Size BALL::Composite::getHeight | ( | ) | const |
Get the height of this item in its tree. The hight of a leaf is 0.
Composite* BALL::Composite::getLastChild | ( | ) |
Return a pointer to the last child.
const Composite* BALL::Composite::getLastChild | ( | ) | const |
Return a const pointer to the last child.
Get the lowest common ancestor of this item with an other. If no common ancestor exists 0 is returned.
Get a const reference to the lowest common ancestor of this item with an other. If no common ancestor exists, 0 is returned.
const PreciseTime& BALL::Composite::getModificationTime | ( | ) | const |
Return the time of last modification
T* BALL::Composite::getNext | ( | const T & | ) |
Find the next composite of type T. This method walks backward in the tree from composite to composite and checks whether the composite object is a kind of T
.
const T* BALL::Composite::getNext | ( | const T & | dummy | ) | const |
Find the next composite of type T (const method). This method walks backward in the tree from composite to composite and checks whether the composite object is a kind of T
.
BALL_INLINE T* BALL::Composite::getNext | ( | const T & | ) |
Definition at line 1767 of file composite.h.
BALL_INLINE const T* BALL::Composite::getNext | ( | const T & | dummy | ) | const |
Definition at line 1797 of file composite.h.
Composite* BALL::Composite::getParent | ( | ) |
Return the composite's parent.
const Composite* BALL::Composite::getParent | ( | ) | const |
Return the composite's parent (const method).
Get the length of the path between two composite objects. If no path exists INVALID_SIZE
is returned.
composite | the second object |
T* BALL::Composite::getPrevious | ( | const T & | ) |
Find the nearest previous composite of type T. This method walks backward in the tree from composite to composite and checks whether the composite object is a kind of T
.
const T* BALL::Composite::getPrevious | ( | const T & | dummy | ) | const |
Find the nearest previous composite of type T (const method). This method walks backward in the tree from composite to composite and checks whether the composite object is a kind of T
.
BALL_INLINE T* BALL::Composite::getPrevious | ( | const T & | ) |
Definition at line 1724 of file composite.h.
BALL_INLINE const T* BALL::Composite::getPrevious | ( | const T & | dummy | ) | const |
Definition at line 1756 of file composite.h.
const Composite& BALL::Composite::getRoot | ( | ) | const |
Get a const reference to the root of this item.
const PreciseTime& BALL::Composite::getSelectionTime | ( | ) | const |
Return the time of last change of selection.
Return a pointer to the sibling index positions from this composite. A pointer to the sibling index
positions to the right (for positive values of index
) or -index
positions to the left (for negative values of index
) is returned. For Index = 0 the this-pointer is returned.
index | the index of the sibling |
Return a const pointer to the sibling index positions from this composite. A pointer to the sibling index
positions to the right (for positive values of index
) or -index
positions to the left (for negative values of index
) is returned. For Index = 0 the this-pointer is returned.
index | the index of the sibling |
bool BALL::Composite::hasAncestor | ( | const T & | dummy | ) | const |
Return true if the node has a ancestor of the same type as dummy.
BALL_INLINE bool BALL::Composite::hasAncestor | ( | const T & | dummy | ) | const |
Definition at line 1808 of file composite.h.
bool BALL::Composite::hasChild | ( | ) | const |
Return true if the node has a child.
bool BALL::Composite::hasNextSibling | ( | ) | const |
Return true if the node has a previous sibling. (Its parent has a child after this.)
bool BALL::Composite::hasParent | ( | ) | const |
Return true if the node has a parent.
bool BALL::Composite::hasPreviousSibling | ( | ) | const |
Return true if the node has a previous sibling. (Its parent has a child before this.)
bool BALL::Composite::hasSibling | ( | ) | const |
Return true if the node has a sibling. (Its parent has other childs.)
Visitor host method. Composites may be visited. For an example look into Composite_test.C
visitor | the visitor |
Exception::GeneralException |
void BALL::Composite::insertAfter | ( | Composite & | composite | ) |
Insert a node after this node. This method inserts composite
after this
node, if this
node has a parent and is not a descendant of composite
. Self-insertion is recognized and ignored (nothing is done).
composite | the node to be inserted in the tree after of this |
void BALL::Composite::insertBefore | ( | Composite & | composite | ) |
Insert a node before this node. This method inserts composite
before this
node, if this
node has a parent and is not a descendant of composite
. Self-insertion is recognized and ignored (nothing is done).
composite | the node to be inserted in the tree before this |
|
static |
Insert a new parent node. This method is used to combine a range of nodes into a single parent. First, the parent
composite is destroy
ed. Then, all nodes from first
through last
are inserted into parent
and parent
is inserted in the former position of first
. The method returns false, if { first} or last
have differing parents, if parent
is identical with either first
or last
, or if first
is already a descendant of parent
.
parent | the new parent of the nodes from first through last |
first | the first of the nodes to be inserted into parent |
last | the last of the nodes to be inserted into parent |
destroy_parent | keeps the current contents of parent if set to true |
Return true if the node has composite as descendent.
Return true if the node has the parent composite
.
Return true if the node is a descendent of composite
.
bool BALL::Composite::isEmpty | ( | ) | const |
Return true if the node does not contain children.
number_of_children_ == 0
bool BALL::Composite::isFirstChild | ( | ) | const |
Return true if the node is the first child of its parent.
Return true if the node is the first child of composite
.
Return true if composite is homomorph to this node. (The subtrees of the two instances have to be of the same form.)
bool BALL::Composite::isInterior | ( | ) | const |
Return true if the node is not the root or a leaf.
bool BALL::Composite::isLastChild | ( | ) | const |
Return true if the node is the last child of its parent.
Return true if the node is the last child of composite
.
Return true if the node is a next sibling of composite
.
Return true if the node is the parent of composite
.
Return true if the node is a previous sibling of composite
.
Return true if the node has composite as ancestor or composite is ancestor of this node.
bool BALL::Composite::isRoot | ( | ) | const |
Return true if the node has no parent.
parent_ == 0
Return true if the node is root of composite.
Return true if the node is a sibling of composite
.
|
virtual |
Test if the subtree with this node as root is valid. (The structure of the subtree has to be valid.)
Reimplemented from BALL::Object.
Reimplemented in BALL::Atom, BALL::Bond, BALL::AtomContainer, BALL::Residue, BALL::SecondaryStructure, BALL::Protein, BALL::Nucleotide, and BALL::NucleicAcid.
Inequality operator.
Assignment operator.
composite | the Composite tree to assign from |
Equality operator. Compares the handles of two Composite objects, therefore two Composite objects can never be equal.
composite | the composite against which equality will be tested |
|
virtual |
Read a persistent object.
pm | the persistence manager |
Exception::GeneralException |
Reimplemented from BALL::PersistentObject.
Reimplemented in BALL::Atom, BALL::Bond, BALL::PDBAtom, BALL::Residue, BALL::SecondaryStructure, BALL::Nucleotide, BALL::AtomContainer, BALL::NucleicAcid, BALL::Protein, BALL::Molecule, BALL::Chain, BALL::System, and BALL::Fragment.
|
virtual |
Write a persistent copy of the object.
pm | the persistence manager |
name | the object name |
Exception::GeneralException |
Reimplemented from BALL::PersistentObject.
Reimplemented in BALL::Atom, BALL::Bond, BALL::PDBAtom, BALL::Residue, BALL::SecondaryStructure, BALL::Nucleotide, BALL::AtomContainer, BALL::NucleicAcid, BALL::Protein, BALL::Molecule, BALL::Chain, BALL::System, and BALL::Fragment.
void BALL::Composite::prependChild | ( | Composite & | composite | ) |
Insert a composite as the first child of this composite. Updates the modification time stamp.
composite | the composite to be inserted |
|
inline |
Definition at line 1086 of file composite.h.
|
inline |
Definition at line 1100 of file composite.h.
|
inline |
Definition at line 1370 of file composite.h.
|
inline |
Definition at line 1383 of file composite.h.
Remove a child from its parent. child
is only removed, if it is a true child of this
.
this
. child | the child to remove |
Size BALL::Composite::removeSelected | ( | ) |
Remove selected subcomposites. This method iterates over all children of the current composite and removes all selected composites by delete
ing them. If the respective Composite are not AutoDeletable, they are just remove d from the hierarchy, but not deleted.
This method is useful in combination with the Selector class in order to remove unwanted partitions of kernel data structures.
Size BALL::Composite::removeUnselected | ( | ) |
Remove unselected subcomposites. This method iterates over all children of the current composite and removes all unselected composites by delete
ing them. If the respective Composite are not AutoDeletable, they are just remove d from the hierarchy, but not deleted.
This method is useful in combination with the Selector class in order to remove unwanted partitions of kernel data structures.
|
inline |
Definition at line 1091 of file composite.h.
|
inline |
Definition at line 1105 of file composite.h.
|
inline |
Definition at line 1375 of file composite.h.
|
inline |
Definition at line 1388 of file composite.h.
void BALL::Composite::replace | ( | Composite & | composite | ) |
This instance and its subtree is removed form its tree and replaced by composite
and its subtree.
this
and composite
. composite | the composite which will be inserted |
|
virtual |
Select a composite. This method selects the composite and all the composites therein.
Reimplemented from BALL::Selectable.
|
private |
Assignment.
composite | the Composite tree to assign from |
deep | a bool deciding whether the assignment will be deep or shallow. |
void BALL::Composite::splice | ( | Composite & | composite | ) |
Insert the children of composite into this composite. The children of composite
are inserted at the position of composite
if composite
is a child of this
. Otherwise the children are inserted using spliceBefore .
composite | the composite to be spliced |
void BALL::Composite::spliceAfter | ( | Composite & | composite | ) |
Append all children of composite
to the children of this composite. The method does nothing, if composite
is identical to this
or is a descendent of this
.
composite | the composite to be spliced |
void BALL::Composite::spliceBefore | ( | Composite & | composite | ) |
Prepend all children of composite
to the children of this composite. The method does nothing, if composite
is identical to this
or is a descendent of this
.
the | composite to be spliced |
Modify a time stamp. Update one or both of the two time stamps with the current time. The time stamp is then propagated up to the root of the composite tree. Each composite contains two stamps. the modification stamp is updated each time the tree structure changes, while the selection stamp is updated each time the selection status changes.
stamp | the time stamp type |
void BALL::Composite::swap | ( | Composite & | composite | ) |
Swap the contents of two composites.
this
and composite
. composite | the composite with which the contents will be swapped |
|
private |
|
friend |
Definition at line 928 of file composite.h.
|
friend |
Definition at line 1048 of file composite.h.
|
friend |
Definition at line 1345 of file composite.h.
|
private |
Definition at line 1447 of file composite.h.
|
static |
Definition at line 107 of file composite.h.
|
static |
Definition at line 108 of file composite.h.
|
private |
Definition at line 1444 of file composite.h.
|
private |
Definition at line 1445 of file composite.h.
|
private |
Definition at line 1451 of file composite.h.
|
private |
Definition at line 1443 of file composite.h.
|
private |
Definition at line 1440 of file composite.h.
|
private |
Definition at line 1449 of file composite.h.
|
private |
Definition at line 1448 of file composite.h.
|
private |
Definition at line 1441 of file composite.h.
|
private |
Definition at line 1442 of file composite.h.
|
private |
Definition at line 1446 of file composite.h.
|
private |
Definition at line 1450 of file composite.h.