Package edu.illinois.cs.cs125.mp5.lib
Class CyclicOrganicMoleculeBuilder
- java.lang.Object
-
- edu.illinois.cs.cs125.mp5.lib.OrganicMoleculeBuilder
-
- edu.illinois.cs.cs125.mp5.lib.CyclicOrganicMoleculeBuilder
-
public final class CyclicOrganicMoleculeBuilder extends OrganicMoleculeBuilder
Provides a convenient way to construct and render cyclic organic molecules. You do not need to use this class.SSSS TTTTT OOO PPPP ! S T O O P P ! SSS T O O PPPP ! S T O O P ! SSSS T OOO P !
Do not modify this class! Changes will be overwritten during official grading.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.illinois.cs.cs125.mp5.lib.OrganicMoleculeBuilder
OrganicMoleculeBuilder.Substituent, OrganicMoleculeBuilder.SubstituentType
-
-
Constructor Summary
Constructors Constructor Description CyclicOrganicMoleculeBuilder(int setCycleLength)
Creates a builder for a cyclic molecule containing the given number of carbons in the ring.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finishBackbone(BondedAtom first, BondedAtom[] firstBonds, BondedAtom last, BondedAtom[] lastBonds)
Makes the molecule cyclic by linking the first and last backbone carbons.protected int
freeValence(int position)
Gets how many bonds a core carbon can make after inclusion in the backbone.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class edu.illinois.cs.cs125.mp5.lib.OrganicMoleculeBuilder
addSubstituent, build, getCoreCarbons, getSubstituents
-
-
-
-
Method Detail
-
finishBackbone
protected void finishBackbone(BondedAtom first, BondedAtom[] firstBonds, BondedAtom last, BondedAtom[] lastBonds)
Makes the molecule cyclic by linking the first and last backbone carbons.- Specified by:
finishBackbone
in classOrganicMoleculeBuilder
- Parameters:
first
- The first backbone carbon.firstBonds
- The first carbon's connected atoms.last
- The last backbone carbon.lastBonds
- The last carbon's connected atoms.
-
freeValence
protected int freeValence(int position)
Gets how many bonds a core carbon can make after inclusion in the backbone.- Specified by:
freeValence
in classOrganicMoleculeBuilder
- Parameters:
position
- The zero-based carbon index.- Returns:
- Always two, since carbons in the ring are guaranteed two links.
-
-