Package edu.illinois.cs.cs125.mp5.lib
Class OrganicMoleculeBuilder.Substituent
- java.lang.Object
-
- edu.illinois.cs.cs125.mp5.lib.OrganicMoleculeBuilder.Substituent
-
- Enclosing class:
- OrganicMoleculeBuilder
public static final class OrganicMoleculeBuilder.Substituent extends java.lang.ObjectHelps represent, build, and attach substituents to the backbone. You do not need to use this class.
-
-
Constructor Summary
Constructors Constructor Description Substituent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BondedAtomattach(BondedAtom coreCarbon)Builds the substituent and attaches it to the backbone.static OrganicMoleculeBuilder.SubstituentcreateAlcohol()Creates a neutral alcohol (OH) substituent.static OrganicMoleculeBuilder.SubstituentcreateAlcohol(int protonation)Creates an (optionally charged) alcohol substituent.static OrganicMoleculeBuilder.SubstituentcreateAlkyl(int length)Creates an alkyl substituent.static OrganicMoleculeBuilder.SubstituentcreateCarbonyl()Creates a carbonyl (double-bonded O) substituent.static OrganicMoleculeBuilder.SubstituentcreateHalogen(ChemicalElement element)Creates a halogen (single-atom) substituent.intgetAlkylLength()Gets how long this alkyl substituent is.ChemicalElementgetHalogen()Gets what halogen element this substituent is.OrganicMoleculeBuilder.SubstituentTypegetType()Gets what kind of substituent this is.intgetValenceConsumed()How many bonds this substituent consumes on the backbone carbon it's attached to.
-
-
-
Method Detail
-
getValenceConsumed
public int getValenceConsumed()
How many bonds this substituent consumes on the backbone carbon it's attached to.- Returns:
- The number of bonds used to connect to this substituent.
-
attach
public BondedAtom attach(BondedAtom coreCarbon)
Builds the substituent and attaches it to the backbone.- Parameters:
coreCarbon- The core carbon bonded to the substituent.- Returns:
- The first atom of the substituent.
-
getType
public OrganicMoleculeBuilder.SubstituentType getType()
Gets what kind of substituent this is.- Returns:
- The substituent type.
-
getAlkylLength
public int getAlkylLength()
Gets how long this alkyl substituent is.- Returns:
- The number of carbons.
-
getHalogen
public ChemicalElement getHalogen()
Gets what halogen element this substituent is.- Returns:
- The chemical element.
-
createAlkyl
public static OrganicMoleculeBuilder.Substituent createAlkyl(int length)
Creates an alkyl substituent.- Parameters:
length- How many carbons in the alkyl chain.- Returns:
- The new substituent.
-
createHalogen
public static OrganicMoleculeBuilder.Substituent createHalogen(ChemicalElement element)
Creates a halogen (single-atom) substituent.- Parameters:
element- Which element this halogen is.- Returns:
- The new substituent.
-
createAlcohol
public static OrganicMoleculeBuilder.Substituent createAlcohol()
Creates a neutral alcohol (OH) substituent.- Returns:
- The new substituent.
-
createAlcohol
public static OrganicMoleculeBuilder.Substituent createAlcohol(int protonation)
Creates an (optionally charged) alcohol substituent.- Parameters:
protonation- The number of protons on the O, from zero to two.- Returns:
- The new substituent.
-
createCarbonyl
public static OrganicMoleculeBuilder.Substituent createCarbonyl()
Creates a carbonyl (double-bonded O) substituent.- Returns:
- The new substituent.
-
-