本文整理汇总了C++中Bond::getSecondAtom方法的典型用法代码示例。如果您正苦于以下问题:C++ Bond::getSecondAtom方法的具体用法?C++ Bond::getSecondAtom怎么用?C++ Bond::getSecondAtom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bond
的用法示例。
在下文中一共展示了Bond::getSecondAtom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: throw
Atom a1;
Atom a2;
Bond b1, b2;
b1.setFirstAtom(&a1);
TEST_EQUAL(b1.getFirstAtom(), &a1);
b1.setFirstAtom(&a2);
TEST_EQUAL(b1.getFirstAtom(), &a2);
RESULT
CHECK(Bond(const String& name, Atom& first, Atom& second, Order order = BALL_BOND_DEFAULT_ORDER, Type type = BALL_BOND_DEFAULT_TYPE) throw(TooManyBonds))
Atom a1;
Atom a2;
Bond b1("name", a1, a2, 1, 2);
TEST_EQUAL(b1.getName(), "name")
TEST_EQUAL(b1.getFirstAtom(), &a1)
TEST_EQUAL(b1.getSecondAtom(), &a2)
TEST_EQUAL(b1.getOrder(), 1)
TEST_EQUAL(b1.getType(), 2)
RESULT
CHECK(static Bond* createBond(Bond& bond, Atom& first, Atom& second) throw(TooManyBonds))
Atom a1;
Atom a2;
Atom a3;
Bond b1;
Bond b2;
TEST_NOT_EQUAL(b1.createBond(b1, a2, a1), 0)
TEST_EQUAL(a2.countBonds(), 1);
TEST_EQUAL(b1.getFirstAtom(), &a1);
TEST_EQUAL(b1.getSecondAtom(), &a2);
示例2: getName_
void MolecularInformation::getName_(Composite& composite)
{
String temp = "UNKNOWN";
switch(type_)
{
case TYPE__BOND:
{
temp.clear();
Bond* bond = RTTI::castTo<Bond>(composite);
Atom* a1 = (Atom*) bond->getFirstAtom();
Atom* a2 = (Atom*) bond->getSecondAtom();
temp = getBondAtomName_(a1) + " -> " + getBondAtomName_(a2);
}
break;
case TYPE__SYSTEM:
{
System* system = RTTI::castTo<System>(composite);
temp = system->getName();
}
break;
case TYPE__RESIDUE:
{
Residue* residue = RTTI::castTo<Residue>(composite);
temp = residue->getName();
temp += " ";
temp += residue->getID();
}
break;
case TYPE__MOLECULE:
case TYPE__PROTEIN:
case TYPE__CHAIN:
case TYPE__FRAGMENT:
case TYPE__SECONDARY_STRUCTURE:
{
AtomContainer* atom_container = RTTI::castTo<AtomContainer>(composite);
temp = atom_container->getName();
}
break;
case TYPE__ATOM:
{
Atom* atom = RTTI::castTo<Atom>(composite);
temp = atom->getName();
}
break;
default:
break;
}
if (type_ == TYPE__SECONDARY_STRUCTURE)
{
const SecondaryStructure* ss = dynamic_cast<SecondaryStructure*>(&composite);
if (ss != 0)
{
switch (ss->getType())
{
case SecondaryStructure::HELIX:
temp += " Helix";
break;
case SecondaryStructure::TURN:
temp += " Turn";
break;
case SecondaryStructure::STRAND:
temp += " Strand";
break;
case SecondaryStructure::COIL:
temp += " Coil";
break;
default:
temp += " Unknown";
}
}
else
{
temp += " Unknown";
}
}
else
{
if (temp == "")
{
temp = "<";
temp += type_name_;
temp += ">";
}
}
name_ = temp;
}