The Octet Molecular Representation Framework v0.8.2

net.sf.octet.model
Class BasicAtomPair

java.lang.Object
  extended bynet.sf.octet.model.BasicAtomPair
All Implemented Interfaces:
AtomPair

public class BasicAtomPair
extends java.lang.Object
implements AtomPair

A default implementation of the AtomPair interface. The equals method does not distinguish between source and target atoms, so BasicAtomPair is suitable for undirected graph representations.

Author:
Richard Apodaca

Constructor Summary
BasicAtomPair(Atom source, Atom target)
          Creates a new BasicAtomPair from source and target.
 
Method Summary
 boolean connects(Atom atom1, Atom atom2)
          Returns true if the specified atoms are connected by this AtomPair.
 boolean contains(Atom atom)
          Returns true if the spacified Atom is linked by this AtomPair.
 boolean equals(java.lang.Object object)
          Returns true if object has the same two atoms as this AtomPair.
 Atom getMate(Atom atom)
          Returns the mate for the specified atom.
 Atom getSource()
          Returns the source Atom.
 Atom getTarget()
          Returns the target Atom.
 int hashCode()
          Required due to override of Object.equals().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicAtomPair

public BasicAtomPair(Atom source,
                     Atom target)
Creates a new BasicAtomPair from source and target.

Parameters:
source - the source Atom
target - the target Atom
Throws:
java.lang.IllegalArgumentException - if source and target are equal by Object.equals
Method Detail

getSource

public Atom getSource()
Description copied from interface: AtomPair
Returns the source Atom.

Specified by:
getSource in interface AtomPair
Returns:
the source atom

getTarget

public Atom getTarget()
Description copied from interface: AtomPair
Returns the target Atom.

Specified by:
getTarget in interface AtomPair
Returns:
the target atom

getMate

public Atom getMate(Atom atom)
Description copied from interface: AtomPair
Returns the mate for the specified atom. Returns null if the specified atom is not connected by this Bond.

Specified by:
getMate in interface AtomPair
Parameters:
atom - the atom for which the mate will be returned
Returns:
the mate to the specified atom

contains

public boolean contains(Atom atom)
Description copied from interface: AtomPair
Returns true if the spacified Atom is linked by this AtomPair.

Specified by:
contains in interface AtomPair
Parameters:
atom - the atom to examine
Returns:
true if the atom is linked by this bond, false otherwise

connects

public boolean connects(Atom atom1,
                        Atom atom2)
Description copied from interface: AtomPair
Returns true if the specified atoms are connected by this AtomPair.

Specified by:
connects in interface AtomPair
Parameters:
atom1 - the first atom
atom2 - the second atom
Returns:
true if the two atoms are connected by this AtomPair, false otherwise

equals

public boolean equals(java.lang.Object object)
Returns true if object has the same two atoms as this AtomPair. Returns false otherwise, or if the source and target atoms of object are equal.

Parameters:
object - the Object to compare
Returns:
true if source and target are contained in this AtomPair, false otherwise

hashCode

public int hashCode()
Required due to override of Object.equals(). Currently, invokes super.hashCode().


The Octet Molecular Representation Framework v0.8.2