Skip to content

Commit

Permalink
Convenience constructors for AtomSignature that take IAtoms rather th…
Browse files Browse the repository at this point in the history
…an atom indices
  • Loading branch information
gilleain authored and egonw committed Jun 23, 2010
1 parent 805103a commit 935b5f6
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/main/org/openscience/cdk/signature/AtomSignature.java
Expand Up @@ -95,6 +95,16 @@ public AtomSignature(int atomIndex, IAtomContainer molecule) {
super.createMaximumHeight(atomIndex, molecule.getAtomCount());
}

/**
* Create an atom signature for the atom <code>atom</code>.
*
* @param atom the atom to make the signature for
* @param molecule the molecule to create the signature from
*/
public AtomSignature(IAtom atom, IAtomContainer molecule) {
this(molecule.getAtomNumber(atom), molecule);
}

/**
* Create an atom signature starting at <code>atomIndex</code> and with a
* maximum height of <code>height</code>.
Expand All @@ -109,6 +119,18 @@ public AtomSignature(int atomIndex, int height, IAtomContainer molecule) {
super.create(atomIndex, molecule.getAtomCount(), height);
}

/**
* Create an atom signature for the atom <code>atom</code> and with a
* maximum height of <code>height</code>.
*
* @param atomIndex the index of the atom that roots this signature
* @param height the maximum height of the signature
* @param molecule the molecule to create the signature from
*/
public AtomSignature(IAtom atom, int height, IAtomContainer molecule) {
this(molecule.getAtomNumber(atom), height, molecule);
}

/**
* Create an atom signature starting at <code>atomIndex</code>, with maximum
* height of <code>height</code>, and using a particular invariant type.
Expand All @@ -125,6 +147,20 @@ public AtomSignature(int atomIndex, int height,
super.create(atomIndex, molecule.getAtomCount(), height);
}

/**
* Create an atom signature for the atom <code>atom</code>, with maximum
* height of <code>height</code>, and using a particular invariant type.
*
* @param atomIndex the index of the atom that roots this signature
* @param height the maximum height of the signature
* @param invariantType the type of invariant (int, string, ...)
* @param molecule the molecule to create the signature from
*/
public AtomSignature(IAtom atom, int height,
InvariantType invariantType, IAtomContainer molecule) {
this(molecule.getAtomNumber(atom), height, invariantType, molecule);
}

@Override /** {@inheritDoc} */
@TestMethod("getIntLabelTest")
protected int getIntLabel(int vertexIndex) {
Expand Down

0 comments on commit 935b5f6

Please sign in to comment.