Changeset e08f45 for molecuilder/src/bond.cpp
- Timestamp:
- Feb 9, 2009, 5:24:10 PM (17 years ago)
- Children:
- 451d7a
- Parents:
- 4aef8a
- git-author:
- Frederik Heber <heber@…> (02/09/09 15:55:37)
- git-committer:
- Frederik Heber <heber@…> (02/09/09 17:24:10)
- File:
-
- 1 edited
-
molecuilder/src/bond.cpp (modified) (11 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/bond.cpp
-
Property mode
changed from
100644to100755
r4aef8a re08f45 16 16 leftatom = NULL; 17 17 rightatom = NULL; 18 previous = NULL;19 next = NULL;18 previous = NULL; 19 next = NULL; 20 20 nr = -1; 21 21 HydrogenBond = 0; 22 22 BondDegree = 0; 23 Used = white;24 Cyclic = false;25 Type = Undetermined;23 Used = white; 24 Cyclic = false; 25 Type = Undetermined; 26 26 }; 27 27 … … 36 36 leftatom = left; 37 37 rightatom = right; 38 previous = NULL;39 next = NULL;38 previous = NULL; 39 next = NULL; 40 40 HydrogenBond = 0; 41 if ((left != NULL) && (right != NULL)) {42 if ((left->type != NULL) && (left->type->Z == 1))43 HydrogenBond++;44 if ((right->type != NULL) && (right->type->Z == 1))45 HydrogenBond++;46 }47 BondDegree = degree;48 nr = number;49 Used = white;50 Cyclic = false;41 if ((left != NULL) && (right != NULL)) { 42 if ((left->type != NULL) && (left->type->Z == 1)) 43 HydrogenBond++; 44 if ((right->type != NULL) && (right->type->Z == 1)) 45 HydrogenBond++; 46 } 47 BondDegree = degree; 48 nr = number; 49 Used = white; 50 Cyclic = false; 51 51 }; 52 52 bond::bond(atom *left, atom *right) 53 53 { 54 leftatom = left;55 rightatom = right;56 previous = NULL;57 next = NULL;58 HydrogenBond = 0;59 if ((left != NULL) && (right != NULL)) {60 if ((left->type != NULL) && (left->type->Z == 1))61 HydrogenBond++;62 if ((right->type != NULL) && (right->type->Z == 1))63 HydrogenBond++;64 }65 BondDegree = 1;66 nr = 0;67 Used = white;68 Cyclic = false;54 leftatom = left; 55 rightatom = right; 56 previous = NULL; 57 next = NULL; 58 HydrogenBond = 0; 59 if ((left != NULL) && (right != NULL)) { 60 if ((left->type != NULL) && (left->type->Z == 1)) 61 HydrogenBond++; 62 if ((right->type != NULL) && (right->type->Z == 1)) 63 HydrogenBond++; 64 } 65 BondDegree = 1; 66 nr = 0; 67 Used = white; 68 Cyclic = false; 69 69 }; 70 70 … … 73 73 bond::~bond() 74 74 { 75 // remove this node from the list structure76 if (previous != NULL) {77 previous->next = next;78 }79 if (next != NULL) {80 next->previous = previous;81 }75 // remove this node from the list structure 76 if (previous != NULL) { 77 previous->next = next; 78 } 79 if (next != NULL) { 80 next->previous = previous; 81 } 82 82 }; 83 83 84 84 ostream & operator << (ostream &ost, bond &b) 85 85 { 86 ost << "[" << b.leftatom->Name << " <" << b.BondDegree << "(H" << b.HydrogenBond << ")>" << b.rightatom->Name << "]";87 return ost;86 ost << "[" << b.leftatom->Name << " <" << b.BondDegree << "(H" << b.HydrogenBond << ")>" << b.rightatom->Name << "]"; 87 return ost; 88 88 }; 89 89 … … 94 94 atom * bond::GetOtherAtom(atom *Atom) const 95 95 { 96 if(leftatom == Atom)97 return rightatom;98 if(rightatom == Atom)99 return leftatom;100 return NULL;96 if(leftatom == Atom) 97 return rightatom; 98 if(rightatom == Atom) 99 return leftatom; 100 return NULL; 101 101 }; 102 102 … … 107 107 bond * bond::GetFirstBond() 108 108 { 109 return GetFirst(this);109 return GetFirst(this); 110 110 }; 111 111 … … 116 116 bond * bond::GetLastBond() 117 117 { 118 return GetLast(this);118 return GetLast(this); 119 119 }; 120 120 … … 124 124 enum Shading bond::IsUsed() 125 125 { 126 return Used;126 return Used; 127 127 }; 128 128 … … 133 133 bool bond::Contains(const atom *ptr) 134 134 { 135 return ((leftatom == ptr) || (rightatom == ptr));135 return ((leftatom == ptr) || (rightatom == ptr)); 136 136 }; 137 137 … … 142 142 bool bond::Contains(const int number) 143 143 { 144 return ((leftatom->nr == number) || (rightatom->nr == number));144 return ((leftatom->nr == number) || (rightatom->nr == number)); 145 145 }; 146 146 … … 149 149 */ 150 150 bool bond::MarkUsed(enum Shading color) { 151 if (Used == black) {152 cerr << "ERROR: Bond " << this << " was already marked black!." << endl;153 return false;154 } else {155 Used = color;156 return true;157 }151 if (Used == black) { 152 cerr << "ERROR: Bond " << this << " was already marked black!." << endl; 153 return false; 154 } else { 155 Used = color; 156 return true; 157 } 158 158 }; 159 159 … … 162 162 */ 163 163 void bond::ResetUsed() { 164 Used = white;164 Used = white; 165 165 }; -
Property mode
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
