Class AtomImpl

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Atom, PDBRecord

    public class AtomImpl
    extends java.lang.Object
    implements Atom, java.io.Serializable, PDBRecord
    Implementation of an Atom of a PDB file. currently the coordinates of an atom are represented by a double[3] array.
    Since:
    1.4
    Version:
    %I% %G%
    Author:
    Andreas Prlic
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BONDS_INITIAL_CAPACITY
      The inital capacity of the bonds list.
    • Constructor Summary

      Constructors 
      Constructor Description
      AtomImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBond​(Bond bond)
      Add a bond
      java.lang.Object clone()
      returns and identical copy of this object .
      java.lang.Character getAltLoc()
      Get alternate Location.
      java.util.List<Bond> getBonds()
      Get all Bonds this atom is part of.
      short getCharge()
      Get the charge of this atom
      double[] getCoords()
      Get the coordinates.
      Element getElement()
      Get element of the atom, e.g.
      Group getGroup()
      Return the parent Group of the Atom.
      java.lang.String getName()
      Get atom name, e.g.
      float getOccupancy()
      Get occupancy.
      int getPDBserial()
      Get PDB atom number.
      float getTempFactor()
      Get temp factor.
      double getX()
      Get coordinate X.
      double getY()
      Get coordinate Y.
      double getZ()
      Get coordinate Z.
      boolean hasBond​(Atom other)
      Test if another atom has a bond to this atom
      void setAltLoc​(java.lang.Character c)
      Set alternate Location.
      void setBonds​(java.util.List<Bond> bonds)
      Sets the bonds
      void setCharge​(short inputCharge)
      Set the charge of this atom
      void setCoords​(double[] c)
      Set the coordinates.
      void setElement​(Element e)
      Set element of the atom name, e.g.
      void setGroup​(Group parent)
      Set the back-reference to its parent Group.
      void setName​(java.lang.String s)
      Set atom name, e.g.
      void setOccupancy​(float occu)
      Set occupancy.
      void setPDBserial​(int i)
      Set PDB atom number.
      void setTempFactor​(float temp)
      Set temp factor .
      void setX​(double x)
      Set the X coordinate.
      void setY​(double y)
      Set the Y coordinate.
      void setZ​(double z)
      Set the Z coordinate.
      java.lang.String toPDB()
      Returns a PDB file like representation of this record.
      void toPDB​(java.lang.StringBuffer buf)
      Appends a PDB file like representation of this record to the provided StringBuffer.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • BONDS_INITIAL_CAPACITY

        public static final int BONDS_INITIAL_CAPACITY
        The inital capacity of the bonds list. Most atoms have a maximum of 3 heavy atom neighbors.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AtomImpl

        public AtomImpl()
    • Method Detail

      • setName

        public void setName​(java.lang.String s)
        Set atom name, e.g. "CA".
        Specified by:
        setName in interface Atom
        Parameters:
        s - a trimmed String specifying the name value
        See Also:
        Atom.getName()
      • getName

        public java.lang.String getName()
        Get atom name, e.g. "CA". Beware that some PDB atom names are ambiguous (e.g. CA, which means C-alpha or Calcium), the ambiguity can simply be resolved by also checking the element with Atom.getElement()
        Specified by:
        getName in interface Atom
        Returns:
        a trimmed String representing the name value
        See Also:
        Atom.setName(java.lang.String)
      • setPDBserial

        public void setPDBserial​(int i)
        Set PDB atom number.
        Specified by:
        setPDBserial in interface Atom
        Parameters:
        i - an int specifying the PDBserial value
        See Also:
        Atom.getPDBserial()
      • getPDBserial

        public int getPDBserial()
        Get PDB atom number.
        Specified by:
        getPDBserial in interface Atom
        Returns:
        an int representing the PDBserial value
        See Also:
        Atom.setPDBserial(int)
      • setCoords

        public void setCoords​(double[] c)
        Set the coordinates.
        Specified by:
        setCoords in interface Atom
        Parameters:
        c - an array of doubles specifying the coords value
        See Also:
        Atom.getCoords()
      • getCoords

        public double[] getCoords()
        Get the coordinates.
        Specified by:
        getCoords in interface Atom
        Returns:
        an array of doubles representing the coords value
        See Also:
        Atom.setCoords(double[])
      • setX

        public void setX​(double x)
        Description copied from interface: Atom
        Set the X coordinate.
        Specified by:
        setX in interface Atom
        Parameters:
        x - a double
        See Also:
        Atom.getX()
      • setY

        public void setY​(double y)
        Description copied from interface: Atom
        Set the Y coordinate.
        Specified by:
        setY in interface Atom
        Parameters:
        y - a double
        See Also:
        Atom.getY()
      • setZ

        public void setZ​(double z)
        Description copied from interface: Atom
        Set the Z coordinate.
        Specified by:
        setZ in interface Atom
        Parameters:
        z - a double
        See Also:
        Atom.getZ()
      • getX

        public double getX()
        Get coordinate X.
        Specified by:
        getX in interface Atom
        Returns:
        a double
        See Also:
        Atom.setX(double)
      • getY

        public double getY()
        Get coordinate Y.
        Specified by:
        getY in interface Atom
        Returns:
        a double
        See Also:
        Atom.setY(double)
      • getZ

        public double getZ()
        Get coordinate Z.
        Specified by:
        getZ in interface Atom
        Returns:
        a double
        See Also:
        Atom.setZ(double)
      • setAltLoc

        public void setAltLoc​(java.lang.Character c)
        Set alternate Location.
        Specified by:
        setAltLoc in interface Atom
        Parameters:
        c - a Character object specifying the alt loc value
        See Also:
        getAltLoc()
      • getAltLoc

        public java.lang.Character getAltLoc()
        Get alternate Location.
        Specified by:
        getAltLoc in interface Atom
        Returns:
        a Character object representing the alt loc value
        See Also:
        setAltLoc(java.lang.Character)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setOccupancy

        public void setOccupancy​(float occu)
        Description copied from interface: Atom
        Set occupancy.
        Specified by:
        setOccupancy in interface Atom
        Parameters:
        occu - a float specifying the occupancy value
        See Also:
        Atom.getOccupancy()
      • getOccupancy

        public float getOccupancy()
        Description copied from interface: Atom
        Get occupancy.
        Specified by:
        getOccupancy in interface Atom
        Returns:
        a float representing the occupancy value
        See Also:
        Atom.setOccupancy(float)
      • setTempFactor

        public void setTempFactor​(float temp)
        Description copied from interface: Atom
        Set temp factor .
        Specified by:
        setTempFactor in interface Atom
        Parameters:
        temp - a float specifying the temp factor value
        See Also:
        Atom.getTempFactor()
      • getTempFactor

        public float getTempFactor()
        Description copied from interface: Atom
        Get temp factor.
        Specified by:
        getTempFactor in interface Atom
        Returns:
        a float representing the temp factor value
        See Also:
        Atom.setTempFactor(float)
      • clone

        public java.lang.Object clone()
        returns and identical copy of this object .
        Specified by:
        clone in interface Atom
        Overrides:
        clone in class java.lang.Object
        Returns:
        and identical copy of this object
      • setGroup

        public void setGroup​(Group parent)
        Set the back-reference to its parent Group.
        Specified by:
        setGroup in interface Atom
        Parameters:
        parent - the parent Group
        See Also:
        Atom.getGroup()
      • getGroup

        public Group getGroup()
        Return the parent Group of the Atom. returns null if the referenced object is not Group
        Specified by:
        getGroup in interface Atom
        Returns:
        Group the parent Group of the Atom, or null
        See Also:
        Atom.setGroup(Group)
      • toPDB

        public java.lang.String toPDB()
        Description copied from interface: PDBRecord
        Returns a PDB file like representation of this record.
        Specified by:
        toPDB in interface PDBRecord
        Returns:
        a String providing a PDB file like representation of the record.
      • toPDB

        public void toPDB​(java.lang.StringBuffer buf)
        Description copied from interface: PDBRecord
        Appends a PDB file like representation of this record to the provided StringBuffer.
        Specified by:
        toPDB in interface PDBRecord
      • getBonds

        public java.util.List<Bond> getBonds()
        Get all Bonds this atom is part of.
        Specified by:
        getBonds in interface Atom
        Returns:
        a list of Bonds or null if no bonds exist for this Atom
      • hasBond

        public boolean hasBond​(Atom other)
        Test if another atom has a bond to this atom
        Specified by:
        hasBond in interface Atom
        Returns:
      • setBonds

        public void setBonds​(java.util.List<Bond> bonds)
        Sets the bonds
        Specified by:
        setBonds in interface Atom
      • addBond

        public void addBond​(Bond bond)
        Description copied from interface: Atom
        Add a bond
        Specified by:
        addBond in interface Atom
        Parameters:
        bond - to be added
        See Also:
        Atom.getBonds()
      • getCharge

        public short getCharge()
        Description copied from interface: Atom
        Get the charge of this atom
        Specified by:
        getCharge in interface Atom
        Returns:
        a the integer charge.
      • setCharge

        public void setCharge​(short inputCharge)
        Description copied from interface: Atom
        Set the charge of this atom
        Specified by:
        setCharge in interface Atom