idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
28,000
protected void setupTransformNatural ( Rectangle2D modelBounds ) { double zoom = rendererModel . getParameter ( ZoomFactor . class ) . getValue ( ) ; this . fontManager . setFontForZoom ( zoom ) ; this . setup ( ) ; }
Set the transform for a non - fit to screen paint .
28,001
protected Rectangle convertToDiagramBounds ( Rectangle2D modelBounds ) { double xCenter = modelBounds . getCenterX ( ) ; double yCenter = modelBounds . getCenterY ( ) ; double modelWidth = modelBounds . getWidth ( ) ; double modelHeight = modelBounds . getHeight ( ) ; double scale = rendererModel . getParameter ( Scale...
Calculate the bounds of the diagram on screen given the current scale zoom and margin .
28,002
void setupTransformToFit ( Rectangle2D screenBounds , Rectangle2D modelBounds , boolean reset ) { double scale = rendererModel . getParameter ( Scale . class ) . getValue ( ) ; if ( screenBounds == null ) return ; setDrawCenter ( screenBounds . getCenterX ( ) , screenBounds . getCenterY ( ) ) ; double drawWidth = scree...
Sets the transformation needed to draw the model on the canvas when the diagram needs to fit the screen .
28,003
public void setParameters ( Object [ ] params ) throws CDKException { if ( params . length != 2 ) throw new CDKException ( "IsotopePatternRule expects two parameter" ) ; if ( ! ( params [ 0 ] instanceof List ) ) throw new CDKException ( "The parameter one must be of type List<Double[]>" ) ; if ( ! ( params [ 1 ] instan...
Sets the parameters attribute of the IsotopePatternRule object .
28,004
public Object [ ] getParameters ( ) { Object [ ] params = new Object [ 2 ] ; if ( pattern == null ) params [ 0 ] = null ; else { List < double [ ] > params0 = new ArrayList < double [ ] > ( ) ; for ( IsotopeContainer isotope : pattern . getIsotopes ( ) ) { params0 . add ( new double [ ] { isotope . getMass ( ) , isotop...
Gets the parameters attribute of the IsotopePatternRule object .
28,005
private IAtom getAnotherUnsaturatedNode ( IAtom exclusionAtom , IAtomContainer exclusionAtomContainer , IAtomContainerSet atomContainers ) throws CDKException { IAtom atom ; for ( IAtomContainer ac : atomContainers . atomContainers ( ) ) { if ( ac != exclusionAtomContainer ) { int next = 0 ; for ( int f = next ; f < ac...
Gets a randomly selected unsaturated atom from the set . If there are any it will be from another container than exclusionAtom .
28,006
public void setup ( IAtomContainer atomContainer , Rectangle screen ) { this . setScale ( atomContainer ) ; Rectangle2D bounds = BoundsCalculator . calculateBounds ( atomContainer ) ; this . modelCenter = new Point2d ( bounds . getCenterX ( ) , bounds . getCenterY ( ) ) ; this . drawCenter = new Point2d ( screen . getC...
Setup the transformations necessary to draw this Atom Container .
28,007
public void reset ( ) { modelCenter = new Point2d ( 0 , 0 ) ; drawCenter = new Point2d ( 200 , 200 ) ; rendererModel . getParameter ( ZoomFactor . class ) . setValue ( 1.0 ) ; setup ( ) ; }
Reset the draw center and model center and set the zoom to 100% .
28,008
public void setScale ( IAtomContainer atomContainer ) { double bondLength = GeometryUtil . getBondLengthAverage ( atomContainer ) ; rendererModel . getParameter ( Scale . class ) . setValue ( this . calculateScaleForBondLength ( bondLength ) ) ; }
Set the scale for an IAtomContainer . It calculates the average bond length of the model and calculates the multiplication factor to transform this to the bond length that is set in the RendererModel .
28,009
private static double estimatedBondLength ( IAtomContainer container ) { if ( container . getBondCount ( ) > 0 ) throw new IllegalArgumentException ( "structure has at least one bond - disconnected scaling not need" ) ; if ( container . getAtomCount ( ) < 2 ) throw new IllegalArgumentException ( "structure must have at...
Determine an estimated bond length for disconnected structures . The distance between all atoms is measured and then the minimum distance is divided by 1 . 5 . This length is required for scaling renderings .
28,010
public void addResidue ( Residue residue ) { if ( residues == null ) residues = new ArrayList < Residue > ( ) ; if ( residues . contains ( residue ) ) { System . out . println ( "Residue: " + residue . getName ( ) + " already present in molecule: " + getID ( ) ) ; return ; } residues . add ( residue ) ; }
Add a Residue to the MDMolecule if not already present .
28,011
public void addChargeGroup ( ChargeGroup chargeGroup ) { if ( chargeGroups == null ) chargeGroups = new ArrayList < ChargeGroup > ( ) ; if ( chargeGroups . contains ( chargeGroup ) ) { System . out . println ( "Charge group: " + chargeGroup . getNumber ( ) + " already present in molecule: " + getID ( ) ) ; return ; } c...
Add a ChargeGroup to the MDMolecule if not already present .
28,012
public void setOutputWriter ( Writer writer ) { if ( writer instanceof PrintWriter ) { this . out = ( PrintWriter ) writer ; } else if ( writer == null ) { this . out = null ; } else { this . out = new PrintWriter ( writer ) ; } }
Overwrites the default writer to which the output is directed .
28,013
public boolean allSaturated ( IAtomContainer ac ) throws CDKException { logger . debug ( "Are all atoms saturated?" ) ; for ( int f = 0 ; f < ac . getAtomCount ( ) ; f ++ ) { if ( ! isSaturated ( ac . getAtom ( f ) , ac ) ) return false ; } return true ; }
Determines of all atoms on the AtomContainer have the right number the lone pair electrons .
28,014
public boolean isSaturated ( IAtom atom , IAtomContainer ac ) throws CDKException { createAtomTypeFactory ( ac . getBuilder ( ) ) ; IAtomType atomType = factory . getAtomType ( atom . getAtomTypeName ( ) ) ; int lpCount = ( Integer ) atomType . getProperty ( CDKConstants . LONE_PAIR_COUNT ) ; int foundLPCount = ac . ge...
Checks if an Atom is saturated their lone pair electrons by comparing it with known AtomTypes .
28,015
public void saturate ( IAtomContainer atomContainer ) throws CDKException { logger . info ( "Saturating atomContainer by adjusting lone pair electrons..." ) ; boolean allSaturated = allSaturated ( atomContainer ) ; if ( ! allSaturated ) { for ( int i = 0 ; i < atomContainer . getAtomCount ( ) ; i ++ ) { saturate ( atom...
Saturates a molecule by setting appropriate number lone pair electrons .
28,016
public void saturate ( IAtom atom , IAtomContainer ac ) throws CDKException { logger . info ( "Saturating atom by adjusting lone pair electrons..." ) ; IAtomType atomType = factory . getAtomType ( atom . getAtomTypeName ( ) ) ; int lpCount = ( Integer ) atomType . getProperty ( CDKConstants . LONE_PAIR_COUNT ) ; int mi...
Saturates an IAtom by adding the appropriate number lone pairs .
28,017
public double calculatePositive ( IAtomContainer atomContainer , IAtom atom ) { if ( atom . getFormalCharge ( ) != 1 ) { return 0.0 ; } StructureResonanceGenerator gRI = new StructureResonanceGenerator ( ) ; List < IReactionProcess > reactionList = gRI . getReactions ( ) ; reactionList . add ( new HyperconjugationReact...
calculate the stabilization of orbitals when they contain deficiency of charge .
28,018
public DescriptorValue calculate ( IAtomContainer container ) { int atomCount = 0 ; if ( container == null ) { return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new IntegerResult ( ( int ) Double . NaN ) , getDescriptorNames ( ) , new CDKException ( "The supplied AtomContai...
this could be useful for other descriptors like polar surface area ...
28,019
private void createCode ( ) throws CDKException { List < TreeNode > sphereNodes = null ; TreeNode tn = null ; for ( int f = 0 ; f < atomContainer . getAtomCount ( ) ; f ++ ) { atomContainer . getAtom ( f ) . setFlag ( CDKConstants . VISITED , false ) ; } for ( int f = 0 ; f < maxSphere ; f ++ ) { sphereNodes = spheres ...
After recursively having established the spheres and assigning each node an appropriate score we now generate the complete HOSE code .
28,020
private String getSphereCode ( List < TreeNode > sphereNodes ) throws CDKException { if ( sphereNodes == null || sphereNodes . size ( ) < 1 ) { return sphereDelimiters [ sphere - 1 ] ; } TreeNode treeNode = null ; StringBuffer code = new StringBuffer ( ) ; IAtom branch = sphereNodes . get ( 0 ) . source . atom ; String...
Generates the string code for a given sphere .
28,021
private double getElementRank ( String symbol ) { for ( int f = 0 ; f < rankedSymbols . length ; f ++ ) { if ( rankedSymbols [ f ] . equals ( symbol ) ) { return symbolRankings [ f ] ; } } IIsotope isotope = isotopeFac . getMajorIsotope ( symbol ) ; if ( isotope . getMassNumber ( ) != null ) { return ( ( double ) 80000...
Gets the element rank for a given element symbol as given in Bremser s publication .
28,022
private void calculateNodeScores ( List < TreeNode > sphereNodes ) throws CDKException { TreeNode treeNode = null ; for ( int i = 0 ; i < sphereNodes . size ( ) ; i ++ ) { treeNode = ( TreeNode ) sphereNodes . get ( i ) ; treeNode . score += getElementRank ( treeNode . symbol ) ; if ( treeNode . bondType <= 4 ) { treeN...
Determines the ranking score for each node allowing for a sorting of nodes within one sphere .
28,023
private void fillUpSphereDelimiters ( ) { logger . debug ( "Sphere: " + sphere ) ; for ( int f = sphere ; f < 4 ; f ++ ) { HOSECode . append ( sphereDelimiters [ f ] ) ; } }
If we use less than four sphere this fills up the code with the missing delimiters such that we are compatible with Bremser s HOSE code table .
28,024
public double getBondLength ( ) { double epsilon = 1e-3 ; PharmacophoreAtom atom1 = ( PharmacophoreAtom ) getAtom ( 0 ) ; PharmacophoreAtom atom2 = ( PharmacophoreAtom ) getAtom ( 1 ) ; PharmacophoreAtom atom3 = ( PharmacophoreAtom ) getAtom ( 2 ) ; double a2 = atom3 . getPoint3d ( ) . distanceSquared ( atom1 . getPoin...
Get the angle between the three pharmacophore groups that make up the constraint .
28,025
public static int getAtomCount ( IChemModel chemModel ) { int count = 0 ; ICrystal crystal = chemModel . getCrystal ( ) ; if ( crystal != null ) { count += crystal . getAtomCount ( ) ; } IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; if ( moleculeSet != null ) { count += MoleculeSetManipulator . getAt...
Get the total number of atoms inside an IChemModel .
28,026
public static void removeAtomAndConnectedElectronContainers ( IChemModel chemModel , IAtom atom ) { ICrystal crystal = chemModel . getCrystal ( ) ; if ( crystal != null ) { if ( crystal . contains ( atom ) ) { crystal . removeAtom ( atom ) ; } return ; } IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; ...
Remove an Atom and the connected ElectronContainers from all AtomContainers inside an IChemModel .
28,027
public static void removeElectronContainer ( IChemModel chemModel , IElectronContainer electrons ) { ICrystal crystal = chemModel . getCrystal ( ) ; if ( crystal != null ) { if ( crystal . contains ( electrons ) ) { crystal . removeElectronContainer ( electrons ) ; } return ; } IAtomContainerSet moleculeSet = chemModel...
Remove an ElectronContainer from all AtomContainers inside an IChemModel .
28,028
public static IAtomContainer createNewMolecule ( IChemModel chemModel ) { IAtomContainer molecule = chemModel . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; if ( chemModel . getMoleculeSet ( ) != null ) { IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; for ( int i = 0 ; i < moleculeSet . g...
Adds a new Molecule to the MoleculeSet inside a given ChemModel . Creates a MoleculeSet if none is contained .
28,029
public static IAtomContainer getRelevantAtomContainer ( IChemModel chemModel , IAtom atom ) { IAtomContainer result = null ; if ( chemModel . getMoleculeSet ( ) != null ) { IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; result = MoleculeSetManipulator . getRelevantAtomContainer ( moleculeSet , atom ) ...
This badly named methods tries to determine which AtomContainer in the ChemModel is best suited to contain added Atom s and Bond s .
28,030
public static IAtomContainer getRelevantAtomContainer ( IChemModel chemModel , IBond bond ) { IAtomContainer result = null ; if ( chemModel . getMoleculeSet ( ) != null ) { IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; result = MoleculeSetManipulator . getRelevantAtomContainer ( moleculeSet , bond ) ...
Retrieves the first IAtomContainer containing a given IBond from an IChemModel .
28,031
public static IReaction getRelevantReaction ( IChemModel chemModel , IAtom atom ) { IReaction reaction = null ; if ( chemModel . getReactionSet ( ) != null ) { IReactionSet reactionSet = chemModel . getReactionSet ( ) ; reaction = ReactionSetManipulator . getRelevantReaction ( reactionSet , atom ) ; } return reaction ;...
Retrieves the first IReaction containing a given IAtom from an IChemModel .
28,032
public static List < IAtomContainer > getAllAtomContainers ( IChemModel chemModel ) { IAtomContainerSet moleculeSet = chemModel . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ; if ( chemModel . getMoleculeSet ( ) != null ) { moleculeSet . add ( chemModel . getMoleculeSet ( ) ) ; } if ( chemModel . getReac...
Returns all the AtomContainer s of a ChemModel .
28,033
public static void setAtomProperties ( IChemModel chemModel , Object propKey , Object propVal ) { if ( chemModel . getMoleculeSet ( ) != null ) { MoleculeSetManipulator . setAtomProperties ( chemModel . getMoleculeSet ( ) , propKey , propVal ) ; } if ( chemModel . getReactionSet ( ) != null ) { ReactionSetManipulator ....
Sets the AtomProperties of all Atoms inside an IChemModel .
28,034
public static List < IChemObject > getAllChemObjects ( IChemModel chemModel ) { List < IChemObject > list = new ArrayList < IChemObject > ( ) ; ICrystal crystal = chemModel . getCrystal ( ) ; if ( crystal != null ) { list . add ( crystal ) ; } IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; if ( molecu...
Retrieve a List of all ChemObject objects within an IChemModel .
28,035
public static double calculateAverageBondLength ( IReaction reaction ) { IAtomContainerSet reactants = reaction . getReactants ( ) ; double reactantAverage = 0.0 ; if ( reactants != null ) { reactantAverage = calculateAverageBondLength ( reactants ) / reactants . getAtomContainerCount ( ) ; } IAtomContainerSet products...
Calculate the average bond length for the bonds in a reaction .
28,036
public static double calculateAverageBondLength ( IAtomContainerSet moleculeSet ) { double averageBondModelLength = 0.0 ; for ( IAtomContainer atomContainer : moleculeSet . atomContainers ( ) ) { averageBondModelLength += GeometryUtil . getBondLengthAverage ( atomContainer ) ; } return averageBondModelLength / molecule...
Calculate the average bond length for the bonds in a molecule set .
28,037
public static double calculateAverageBondLength ( IChemModel model ) { IAtomContainerSet moleculeSet = model . getMoleculeSet ( ) ; if ( moleculeSet == null ) { IReactionSet reactionSet = model . getReactionSet ( ) ; if ( reactionSet != null ) { return calculateAverageBondLength ( reactionSet ) ; } return 0.0 ; } retur...
Calculate the average bond length for the bonds in a chem model .
28,038
public static double calculateAverageBondLength ( IReactionSet reactionSet ) { double averageBondModelLength = 0.0 ; for ( IReaction reaction : reactionSet . reactions ( ) ) { averageBondModelLength += calculateAverageBondLength ( reaction ) ; } return averageBondModelLength / reactionSet . getReactionCount ( ) ; }
Calculate the average bond length for the bonds in a reaction set .
28,039
public Color getAtomColor ( IAtom atom , Color defaultColor ) { Color color = defaultColor ; String symbol = atom . getSymbol ( ) . toUpperCase ( ) ; if ( atom . getAtomicNumber ( ) != null && ATOM_COLORS_MASSNUM . containsKey ( atom . getAtomicNumber ( ) ) ) { color = ATOM_COLORS_MASSNUM . get ( atom . getAtomicNumber...
Returns the font color for atom given atom .
28,040
public final String toSvgStr ( String units ) { if ( ! units . equals ( UNITS_MM ) && ! units . equals ( UNITS_PX ) ) throw new IllegalArgumentException ( "Units must be 'px' or 'mm'!" ) ; return toVecStr ( SVG_FMT , units ) ; }
Render the image to an SVG image .
28,041
double getPaddingValue ( double defaultPadding ) { double padding = model . get ( RendererModel . Padding . class ) ; if ( padding == AUTOMATIC ) padding = defaultPadding ; return padding ; }
Access the specified padding value or fallback to a provided default .
28,042
double getMarginValue ( final double defaultMargin ) { double margin = model . get ( BasicSceneGenerator . Margin . class ) ; if ( margin == AUTOMATIC ) margin = defaultMargin ; return margin ; }
Access the specified margin value or fallback to a provided default .
28,043
public final List < String > listFormats ( ) { final List < String > formats = new ArrayList < > ( ) ; formats . add ( SVG_FMT ) ; formats . add ( SVG_FMT . toUpperCase ( Locale . ROOT ) ) ; formats . add ( PS_FMT ) ; formats . add ( PS_FMT . toUpperCase ( Locale . ROOT ) ) ; formats . add ( EPS_FMT ) ; formats . add (...
List the available formats that can be rendered .
28,044
public final void writeTo ( String fmt , String path ) throws IOException { writeTo ( fmt , new File ( replaceTildeWithHomeDir ( ensureSuffix ( path , fmt ) ) ) ) ; }
Write the depiction to the provided file path .
28,045
public final void writeTo ( String path ) throws IOException { final int i = path . lastIndexOf ( DOT ) ; if ( i < 0 || i + 1 == path . length ( ) ) throw new IOException ( "Cannot find suffix in provided path: " + path ) ; final String fmt = path . substring ( i + 1 ) ; writeTo ( fmt , path ) ; }
Write the depiction to the provided file path the format is determined by the path suffix .
28,046
private static String replaceTildeWithHomeDir ( String path ) { if ( path . startsWith ( "~/" ) ) return System . getProperty ( "user.home" ) + path . substring ( 1 ) ; return path ; }
Utility for resolving paths on unix systems that contain tilda for the home directory .
28,047
protected final void draw ( IDrawVisitor visitor , double zoom , Bounds bounds , Rectangle2D viewBounds ) { double modelScale = zoom * model . get ( BasicSceneGenerator . Scale . class ) ; double zoomToFit = Math . min ( viewBounds . getWidth ( ) / ( bounds . width ( ) * modelScale ) , viewBounds . getHeight ( ) / ( bo...
Low - level draw method used by other rendering methods .
28,048
public List < IAtomType > readAtomTypes ( IChemObjectBuilder builder ) throws IOException { List < IAtomType > atomTypes ; if ( ins == null ) { try { ins = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( configFile ) ; } catch ( Exception exc ) { logger . error ( exc . getMessage ( ) ) ; logger . debug...
Reads the atom types from the CDK based atom type list .
28,049
public void add ( IRenderingElement element ) { if ( element != null ) { if ( element . getClass ( ) . equals ( ElementGroup . class ) ) elements . addAll ( ( ( ElementGroup ) element ) . elements ) ; else elements . add ( element ) ; } }
Add a new element to the group .
28,050
public int getBondOrderSum ( ) { int sum = 0 ; for ( int i = 0 ; i < getBondCount ( ) ; i ++ ) { IBond . Order order = getBond ( i ) . getOrder ( ) ; if ( order != null ) { sum += order . numeric ( ) ; } } return sum ; }
Returns the sum of all bond orders in the ring .
28,051
public void process ( RootDoc root ) throws IOException { out . println ( "<XMI xmi.version=\"1.1\" >" ) ; out . println ( " <XMI.header>" ) ; out . println ( " <XMI.metamodel href=\"/vol/acfiles7/egonw/SourceForge/CDK/cdk/reports/javadoc/test2.xmi\" version=\"1.1\" name=\"UML\" />" ) ; out . println ( " <XMI.model h...
Method that serializes RootDoc objects containing the information from the Java source code .
28,052
public static boolean start ( RootDoc root ) { try { String filename = "classes.xmi" ; PrintWriter out = new PrintWriter ( ( Writer ) new FileWriter ( filename ) ) ; XMIDoclet doclet = new XMIDoclet ( out ) ; doclet . process ( root ) ; out . flush ( ) ; return true ; } catch ( Exception e ) { System . err . println ( ...
Method that must be implemented by JavaDoc Doclets .
28,053
public static List < IRingSet > partitionRings ( IRingSet ringSet ) { List < IRingSet > ringSets = new ArrayList < IRingSet > ( ) ; if ( ringSet . getAtomContainerCount ( ) == 0 ) return ringSets ; IRing ring = ( IRing ) ringSet . getAtomContainer ( 0 ) ; if ( ring == null ) return ringSets ; IRingSet rs = ring . getBu...
Partitions a RingSet into RingSets of connected rings . Rings which share an Atom a Bond or three or more atoms with at least on other ring in the RingSet are considered connected . Thus molecules such as azulene and indole will return a List with 1 element .
28,054
public static IAtomContainer convertToAtomContainer ( IRingSet ringSet ) { IRing ring = ( IRing ) ringSet . getAtomContainer ( 0 ) ; if ( ring == null ) return null ; IAtomContainer ac = ring . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; for ( int i = 0 ; i < ringSet . getAtomContainerCount ( ) ; i ++ ) {...
Converts a RingSet to an AtomContainer .
28,055
private static IRingSet walkRingSystem ( IRingSet rs , IRing ring , IRingSet newRs ) { IRing tempRing ; IRingSet tempRings = rs . getConnectedRings ( ring ) ; rs . removeAtomContainer ( ring ) ; for ( IAtomContainer container : tempRings . atomContainers ( ) ) { tempRing = ( IRing ) container ; if ( ! newRs . contains ...
Perform a walk in the given RingSet starting at a given Ring and recursively searching for other Rings connected to this ring . By doing this it finds all rings in the RingSet connected to the start ring putting them in newRs and removing them from rs .
28,056
public DescriptorValue calculate ( IAtom atom , IAtomContainer container ) { double value ; String originalAtomtypeName = atom . getAtomTypeName ( ) ; Integer originalNeighborCount = atom . getFormalNeighbourCount ( ) ; Integer originalValency = atom . getValency ( ) ; Double originalBondOrderSum = atom . getBondOrderS...
This method calculates the ionization potential of an atom .
28,057
private boolean familyHalogen ( IAtom atom ) { String symbol = atom . getSymbol ( ) ; return symbol . equals ( "F" ) || symbol . equals ( "Cl" ) || symbol . equals ( "Br" ) || symbol . equals ( "I" ) ; }
Looking if the Atom belongs to the halogen family .
28,058
private static List < String > extractInfo ( String str ) { int beg = 0 ; int end = 0 ; int len = str . length ( ) ; List < String > parts = new ArrayList < > ( ) ; while ( end < len && ! Character . isSpaceChar ( str . charAt ( end ) ) ) end ++ ; parts . add ( str . substring ( beg , end ) ) ; while ( end < len && Cha...
Extract the information from a line which contains HOSE_ID & energy .
28,059
public Double getExactMass ( ) { double totalMass = 0.0 ; for ( IAtom atom : fragment . atoms ( ) ) { totalMass += atom . getExactMass ( ) ; } return totalMass ; }
The exact mass of an FragmentAtom is defined as the sum of exact masses of the IAtom s in the fragment .
28,060
public String getSymbol ( ) { if ( atomicNumber == null ) return null ; if ( atomicNumber == 0 ) return "R" ; return Elements . ofNumber ( atomicNumber ) . symbol ( ) ; }
Returns the element symbol of this element .
28,061
public boolean compare ( Object object ) { if ( ! ( object instanceof Element ) ) { return false ; } if ( ! super . compare ( object ) ) { return false ; } Element elem = ( Element ) object ; return Objects . equal ( atomicNumber , elem . atomicNumber ) ; }
Compares an Element with this Element .
28,062
protected int compatibilityGraphNodes ( ) throws IOException { compGraphNodes . clear ( ) ; List < IAtom > basicAtomVecA = null ; List < IAtom > basicAtomVecB = null ; IAtomContainer reactant = source ; IAtomContainer product = target ; basicAtomVecA = reduceAtomSet ( reactant ) ; basicAtomVecB = reduceAtomSet ( produc...
Generate Compatibility Graph Nodes
28,063
protected int compatibilityGraph ( ) throws IOException { int compGraphNodesListSize = compGraphNodes . size ( ) ; cEdges = new ArrayList < Integer > ( ) ; dEdges = new ArrayList < Integer > ( ) ; for ( int a = 0 ; a < compGraphNodesListSize ; a += 3 ) { int indexA = compGraphNodes . get ( a ) ; int indexAPlus1 = compG...
Generate Compatibility Graph Nodes Bond Insensitive
28,064
protected Integer compatibilityGraphNodesIfCEdgeIsZero ( ) throws IOException { int countNodes = 1 ; List < String > map = new ArrayList < String > ( ) ; compGraphNodesCZero = new ArrayList < Integer > ( ) ; LabelContainer labelContainer = LabelContainer . getInstance ( ) ; compGraphNodes . clear ( ) ; for ( int i = 0 ...
compGraphNodesCZero is used to build up of the edges of the compatibility graph
28,065
protected int compatibilityGraphCEdgeZero ( ) throws IOException { int compGraphNodesCZeroListSize = compGraphNodesCZero . size ( ) ; cEdges = new ArrayList < Integer > ( ) ; dEdges = new ArrayList < Integer > ( ) ; for ( int a = 0 ; a < compGraphNodesCZeroListSize ; a += 4 ) { int indexA = compGraphNodesCZero . get ( ...
compatibilityGraphCEdgeZero is used to build up of the edges of the compatibility graph BIS
28,066
public static double evalSimpleIndex ( IAtomContainer atomContainer , List < List < Integer > > fragLists ) { double sum = 0 ; for ( List < Integer > fragList : fragLists ) { double prod = 1.0 ; for ( Integer atomSerial : fragList ) { IAtom atom = atomContainer . getAtom ( atomSerial ) ; int nconnected = atomContainer ...
Evaluates the simple chi index for a set of fragments .
28,067
public static double evalValenceIndex ( IAtomContainer atomContainer , List < List < Integer > > fragList ) throws CDKException { try { IsotopeFactory ifac = Isotopes . getInstance ( ) ; ifac . configureAtoms ( atomContainer ) ; } catch ( IOException e ) { throw new CDKException ( "IO problem occurred when using the CD...
Evaluates the valence corrected chi index for a set of fragments .
28,068
protected static double deltavSulphur ( IAtom atom , IAtomContainer atomContainer ) { if ( ! atom . getSymbol ( ) . equals ( "S" ) ) return - 1 ; List < IAtom > connected = atomContainer . getConnectedAtomsList ( atom ) ; for ( IAtom connectedAtom : connected ) { if ( connectedAtom . getSymbol ( ) . equals ( "S" ) && a...
Evaluates the empirical delt V for some S environments .
28,069
private static double deltavPhosphorous ( IAtom atom , IAtomContainer atomContainer ) { if ( ! atom . getSymbol ( ) . equals ( "P" ) ) return - 1 ; List < IAtom > connected = atomContainer . getConnectedAtomsList ( atom ) ; int conditions = 0 ; if ( connected . size ( ) == 4 ) conditions ++ ; for ( IAtom connectedAtom ...
Checks whether the P atom is in a PO environment .
28,070
private static List < List < Integer > > getUniqueBondSubgraphs ( List < List < RMap > > subgraphs , IAtomContainer ac ) { List < List < Integer > > bondList = new ArrayList < List < Integer > > ( ) ; for ( List < RMap > subgraph : subgraphs ) { List < RMap > current = subgraph ; List < Integer > ids = new ArrayList < ...
Converts a set of bond mappings to a unique set of atom paths .
28,071
public Iterable < IChemSequence > chemSequences ( ) { return new Iterable < IChemSequence > ( ) { public Iterator < IChemSequence > iterator ( ) { return new ChemSequenceIterator ( ) ; } } ; }
Returns the Iterable to ChemSequences of this container .
28,072
protected void growChemSequenceArray ( ) { growArraySize = chemSequences . length ; IChemSequence [ ] newchemSequences = new ChemSequence [ chemSequences . length + growArraySize ] ; System . arraycopy ( chemSequences , 0 , newchemSequences , 0 , chemSequences . length ) ; chemSequences = newchemSequences ; }
Grows the ChemSequence array by a given size .
28,073
public int compare ( String o1 , String o2 ) { if ( C_ELEMENT_SYMBOL . equals ( o1 ) ) { if ( C_ELEMENT_SYMBOL . equals ( o2 ) ) { return 0 ; } else { return - 1 ; } } else if ( H_ELEMENT_SYMBOL . equals ( o1 ) ) { if ( C_ELEMENT_SYMBOL . equals ( o2 ) ) { return 1 ; } else if ( H_ELEMENT_SYMBOL . equals ( o2 ) ) { ret...
Returns a negative if o1 comes before o2 in a molecular formula returns zero if they are identical and positive if o1 comes after o2 in the formula .
28,074
private Rectangle2D transformedBounds ( Shape shape ) { Rectangle2D rectangle2D = shape . getBounds2D ( ) ; Point2D minPoint = new Point2D . Double ( rectangle2D . getMinX ( ) , rectangle2D . getMinY ( ) ) ; Point2D maxPoint = new Point2D . Double ( rectangle2D . getMaxX ( ) , rectangle2D . getMaxY ( ) ) ; transform . ...
Access the bounds of a shape that have been transformed .
28,075
Point2D getCenter ( ) { final Rectangle2D bounds = getBounds ( ) ; return new Point2D . Double ( bounds . getCenterX ( ) , bounds . getCenterY ( ) ) ; }
Access the transformed center of the whole outline .
28,076
private Point2D getGlyphCenter ( final int index ) { if ( text . length ( ) == 1 ) return getCenter ( ) ; final Shape glyph = glyphs . getGlyphOutline ( index ) ; final Rectangle2D glyphBounds = transformedBounds ( glyph ) ; return new Point2D . Double ( glyphBounds . getCenterX ( ) , glyphBounds . getCenterY ( ) ) ; }
Determines the transformed centre of a specified glyph .
28,077
TextOutline transform ( AffineTransform nextTransform ) { final AffineTransform combinedTransform = new AffineTransform ( ) ; combinedTransform . concatenate ( nextTransform ) ; combinedTransform . concatenate ( transform ) ; return new TextOutline ( text , glyphs , outline , combinedTransform ) ; }
Add a transformation to the outline .
28,078
public void addListener ( IChemObjectListener col ) { List < IChemObjectListener > listeners = lazyChemObjectListeners ( ) ; if ( ! listeners . contains ( col ) ) { listeners . add ( col ) ; } }
Use this to add yourself to this IChemObject as a listener . In order to do so you must implement the ChemObjectListener Interface .
28,079
public void removeListener ( IChemObjectListener col ) { if ( chemObjectListeners == null ) { return ; } List < IChemObjectListener > listeners = lazyChemObjectListeners ( ) ; if ( listeners . contains ( col ) ) { listeners . remove ( col ) ; } }
Use this to remove a ChemObjectListener from the ListenerList of this IChemObject . It will then not be notified of change in this object anymore .
28,080
public void notifyChanged ( ) { if ( getNotification ( ) && getListenerCount ( ) > 0 ) { List < IChemObjectListener > listeners = lazyChemObjectListeners ( ) ; for ( Object listener : listeners ) { ( ( IChemObjectListener ) listener ) . stateChanged ( new QueryChemObjectChangeEvent ( this ) ) ; } } }
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it .
28,081
private Map < Object , Object > lazyProperties ( ) { if ( properties == null ) { properties = new HashMap < Object , Object > ( ) ; } return properties ; }
Lazy creation of properties hash .
28,082
public void setProperty ( Object description , Object property ) { lazyProperties ( ) . put ( description , property ) ; notifyChanged ( ) ; }
Sets a property for a IChemObject .
28,083
public < T > T getProperty ( Object description ) { @ SuppressWarnings ( "unchecked" ) T value = ( T ) lazyProperties ( ) . get ( description ) ; return value ; }
Returns a property for the IChemObject .
28,084
public IChemFormat [ ] findChemFormats ( int features ) { if ( formats == null ) loadFormats ( ) ; Iterator < IChemFormat > iter = formats . iterator ( ) ; List < IChemFormat > matches = new ArrayList < IChemFormat > ( ) ; while ( iter . hasNext ( ) ) { IChemFormat format = ( IChemFormat ) iter . next ( ) ; if ( ( form...
Finds IChemFormats that provide a container for serialization for the given features . The syntax of the integer is explained in the DataFeatures class .
28,085
public IChemObjectWriter createWriter ( IChemFormat format ) { if ( format != null ) { String writerClassName = format . getWriterClassName ( ) ; if ( writerClassName != null ) { try { if ( registeredReaders . containsKey ( writerClassName ) ) { Class < IChemObjectWriter > writer = registeredReaders . get ( writerClass...
Creates a new IChemObjectWriter based on the given IChemFormat .
28,086
public DescriptorValue calculate ( IAtom atom , IAtomContainer ac ) { double polarizability ; try { String originalAtomtypeName = atom . getAtomTypeName ( ) ; Integer originalNeighborCount = atom . getFormalNeighbourCount ( ) ; Integer originalHCount = atom . getImplicitHydrogenCount ( ) ; Integer originalValency = ato...
The method calculates the Effective Atom Polarizability of a given atom It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .
28,087
public List < IAtomType > readAtomTypes ( IChemObjectBuilder builder ) throws IOException { List < IAtomType > atomTypes ; if ( ins == null ) throw new IOException ( "There was a problem getting an input stream" ) ; OWLAtomTypeReader reader = new OWLAtomTypeReader ( new InputStreamReader ( ins ) ) ; atomTypes = reader ...
Reads the atom types from the OWL based atom type list .
28,088
public static boolean isIsomorph ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { if ( sourceGraph instanceof IQueryAtomContainer ) { throw new CDKException ( "The first IAtomContainer must not be an IQueryAtomContainer" ) ; } if ( targetGraph . getAtomCount (...
Tests if sourceGraph and targetGraph are isomorph .
28,089
public static List < CDKRMap > getIsomorphMap ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { if ( sourceGraph instanceof IQueryAtomContainer ) { throw new CDKException ( "The first IAtomContainer must not be an IQueryAtomContainer" ) ; } List < CDKRMap > res...
Returns the first isomorph mapping found or null .
28,090
public static List < CDKRMap > getIsomorphAtomsMap ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { if ( sourceGraph instanceof IQueryAtomContainer ) { throw new CDKException ( "The first IAtomContainer must not be an IQueryAtomContainer" ) ; } List < CDKRMap ...
Returns the first isomorph atom mapping found for targetGraph in sourceGraph .
28,091
public static List < List < CDKRMap > > getIsomorphMaps ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { return search ( sourceGraph , targetGraph , getBitSet ( sourceGraph ) , getBitSet ( targetGraph ) , true , true , shouldMatchBonds ) ; }
Returns all the isomorph mappings found between two atom containers .
28,092
public static List < List < CDKRMap > > getSubgraphMaps ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { return search ( sourceGraph , targetGraph , new BitSet ( ) , getBitSet ( targetGraph ) , true , true , shouldMatchBonds ) ; }
Returns all the subgraph bondA1 mappings found for targetGraph in sourceGraph . This is an ArrayList of ArrayLists of CDKRMap objects .
28,093
public static List < CDKRMap > getSubgraphMap ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { List < CDKRMap > result = null ; List < List < CDKRMap > > rMapsList = search ( sourceGraph , targetGraph , new BitSet ( ) , getBitSet ( targetGraph ) , false , fals...
Returns the first subgraph bondA1 mapping found for targetGraph in sourceGraph .
28,094
public static List < List < CDKRMap > > getSubgraphAtomsMaps ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { List < CDKRMap > list = checkSingleAtomCases ( sourceGraph , targetGraph ) ; if ( list == null ) { return makeAtomsMapsOfBondsMaps ( CDKMCS . getSubgr...
Returns all subgraph atom mappings found for targetGraph in sourceGraph . This is an ArrayList of ArrayLists of CDKRMap objects .
28,095
public static List < CDKRMap > getSubgraphAtomsMap ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { List < CDKRMap > list = checkSingleAtomCases ( sourceGraph , targetGraph ) ; if ( list == null ) { return makeAtomsMapOfBondsMap ( CDKMCS . getSubgraphMap ( sou...
Returns the first subgraph atom mapping found for targetGraph in sourceGraph .
28,096
public static boolean isSubgraph ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { if ( sourceGraph instanceof IQueryAtomContainer ) { throw new CDKException ( "The first IAtomContainer must not be an IQueryAtomContainer" ) ; } if ( targetGraph . getAtomCount (...
Tests if targetGraph atom subgraph of sourceGraph .
28,097
public static List < IAtomContainer > getOverlaps ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { List < List < CDKRMap > > rMapsList = search ( sourceGraph , targetGraph , new BitSet ( ) , new BitSet ( ) , true , false , shouldMatchBonds ) ; ArrayList < IAto...
Returns all the maximal common substructure between 2 atom containers .
28,098
public static IAtomContainer project ( List < CDKRMap > rMapList , IAtomContainer graph , int key ) { IAtomContainer atomContainer = graph . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; Map < IAtom , IAtom > table = new HashMap < IAtom , IAtom > ( ) ; IAtom atom1 ; IAtom atom2 ; IAtom atom ; IBond bond ; f...
Projects atom list of CDKRMap on atom molecule .
28,099
public static ArrayList < IAtomContainer > projectList ( List < List < CDKRMap > > rMapsList , IAtomContainer graph , int key ) { ArrayList < IAtomContainer > graphList = new ArrayList < IAtomContainer > ( ) ; for ( List < CDKRMap > rMapList : rMapsList ) { IAtomContainer atomContainer = project ( rMapList , graph , ke...
Projects atom list of RMapsList on atom molecule .