_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q157200
MolecularFormulaManipulator.correctMass
train
private static double correctMass(double mass, Integer charge) { if (charge == null) return mass; double massE = 0.00054857990927; if (charge > 0) mass -= massE * charge; else if (charge < 0) mass += massE * Math.abs(charge); return mass; }
java
{ "resource": "" }
q157201
MolecularFormulaManipulator.getTotalMassNumber
train
public static double getTotalMassNumber(IMolecularFormula formula) { double mass = 0.0; for (IIsotope isotope : formula.isotopes()) { try { IIsotope isotope2 = Isotopes.getInstance().getMajorIsotope(isotope.getSymbol()); if (isotope2 != null) { ...
java
{ "resource": "" }
q157202
MolecularFormulaManipulator.getTotalNaturalAbundance
train
public static double getTotalNaturalAbundance(IMolecularFormula formula) { double abundance = 1.0; for (IIsotope isotope : formula.isotopes()) { if (isotope.getNaturalAbundance() == null) return 0.0; abundance = abundance * Math.pow(isotope.getNaturalAbundance(), formula.getIsoto...
java
{ "resource": "" }
q157203
MolecularFormulaManipulator.getDBE
train
public static double getDBE(IMolecularFormula formula) throws CDKException { int valencies[] = new int[5]; IAtomContainer ac = getAtomContainer(formula); AtomTypeFactory factory = AtomTypeFactory.getInstance( "org/openscience/cdk/config/data/structgen_atomtypes.xml", ac.getBuilde...
java
{ "resource": "" }
q157204
MolecularFormulaManipulator.compare
train
public static boolean compare(IMolecularFormula formula1, IMolecularFormula formula2) { if (!Objects.equals(formula1.getCharge(), formula2.getCharge())) return false; if (formula1.getIsotopeCount() != formula2.getIsotopeCount()) return false; for (IIsotope isotope : formula1.isotopes()) { ...
java
{ "resource": "" }
q157205
MolecularFormulaManipulator.muliplier
train
private static String muliplier(String formula, int factor) { String finalformula = ""; String recentElementSymbol = ""; String recentElementCountString = "0"; for (int f = 0; f < formula.length(); f++) { char thisChar = formula.charAt(f); if (f < formula.length()...
java
{ "resource": "" }
q157206
MolecularFormulaManipulator.adjustProtonation
train
public static boolean adjustProtonation(IMolecularFormula mf, int hcnt) { if (mf == null) throw new NullPointerException("No formula provided"); if (hcnt == 0) return false; // no protons to add final IChemObjectBuilder bldr = mf.getBuilder(); final int chg = mf.getCharg...
java
{ "resource": "" }
q157207
DoubleBondElementEncoderFactory.findOther
train
private static int findOther(int[] vs, int u, int x) { for (int v : vs) { if (v != u && v != x) return v; } throw new IllegalArgumentException("vs[] did not contain another vertex"); }
java
{ "resource": "" }
q157208
DoubleBondElementEncoderFactory.indexMap
train
private static Map<IAtom, Integer> indexMap(Map<IAtom, Integer> map, IAtomContainer container) { if (map != null) return map; map = new HashMap<IAtom, Integer>(); for (IAtom a : container.atoms()) { map.put(a, map.size()); } return map; }
java
{ "resource": "" }
q157209
IsotopePatternGenerator.getIsotopes
train
public IsotopePattern getIsotopes(IMolecularFormula molFor) { if (builder == null) { try { isoFactory = Isotopes.getInstance(); builder = molFor.getBuilder(); } catch (Exception e) { e.printStackTrace(); } } Str...
java
{ "resource": "" }
q157210
BasicAtomGenerator.canDraw
train
protected boolean canDraw(IAtom atom, IAtomContainer container, RendererModel model) { // don't draw atoms without coordinates if (!hasCoordinates(atom)) { return false; } // don't draw invisible hydrogens if (invisibleHydrogen(atom, model)) { return fals...
java
{ "resource": "" }
q157211
BasicAtomGenerator.generateCompactElement
train
public IRenderingElement generateCompactElement(IAtom atom, RendererModel model) { Point2d point = atom.getPoint2d(); double radius = (Double) model.get(AtomRadius.class) / model.getParameter(Scale.class).getValue(); double distance = 2 * radius; if (model.get(CompactShape.class) == Shap...
java
{ "resource": "" }
q157212
BasicAtomGenerator.generateElement
train
public AtomSymbolElement generateElement(IAtom atom, int alignment, RendererModel model) { String text; if (atom instanceof IPseudoAtom) { text = ((IPseudoAtom) atom).getLabel(); } else { text = atom.getSymbol(); } return new AtomSymbolElement(atom.getPoin...
java
{ "resource": "" }
q157213
BasicAtomGenerator.showCarbon
train
protected boolean showCarbon(IAtom carbonAtom, IAtomContainer container, RendererModel model) { if ((Boolean) model.get(KekuleStructure.class)) return true; if (carbonAtom.getFormalCharge() != 0) return true; int connectedBondCount = container.getConnectedBondsList(carbonAtom).size(); ...
java
{ "resource": "" }
q157214
AminoAcidManipulator.removeAcidicOxygen
train
public static void removeAcidicOxygen(IAminoAcid acid) throws CDKException { if (acid.getCTerminus() == null) throw new CDKException("Cannot remove oxygen: C-terminus is not defined!"); java.util.List<IBond> bonds = acid.getConnectedBondsList(acid.getCTerminus()); // ok, look for the oxygen whi...
java
{ "resource": "" }
q157215
AminoAcidManipulator.addAcidicOxygen
train
public static void addAcidicOxygen(IAminoAcid acid) throws CDKException { if (acid.getCTerminus() == null) throw new CDKException("Cannot add oxygen: C-terminus is not defined!"); IAtom acidicOxygen = acid.getBuilder().newInstance(IAtom.class, "O"); acid.addAtom(acidicOxygen); acid.addB...
java
{ "resource": "" }
q157216
MassToFormulaTool.setRestrictions
train
public void setRestrictions(List<IRule> rulesNew) throws CDKException { Iterator<IRule> itRules = rulesNew.iterator(); while (itRules.hasNext()) { IRule rule = itRules.next(); if (rule instanceof ElementRule) { mfRange = (MolecularFormulaRange) ((Object[]) rule.g...
java
{ "resource": "" }
q157217
MassToFormulaTool.setDefaultRestrictions
train
public void setDefaultRestrictions() { try { callDefaultRestrictions(); } catch (CDKException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
java
{ "resource": "" }
q157218
MassToFormulaTool.orderList
train
private List<IIsotope> orderList(List<IIsotope> isotopes_TO) { List<IIsotope> newOrderList = new ArrayList<IIsotope>(); for (int i = 0; i < orderElements.length; i++) { String symbol = orderElements[i]; Iterator<IIsotope> itIso = isotopes_TO.iterator(); while (itIso.h...
java
{ "resource": "" }
q157219
MassToFormulaTool.getMaxOccurence
train
private int getMaxOccurence(double massTo, int element_pos, int[] matrix, List<IIsotope> isoToCond_new) { double massIn = isoToCond_new.get(element_pos).getExactMass(); double massToM = massTo; for (int i = 0; i < matrix.length; i++) if (i != element_pos) if (matrix[i] != 0) massToM ...
java
{ "resource": "" }
q157220
MassToFormulaTool.getFormula
train
private IMolecularFormula getFormula(List<IIsotope> isoToCond_new, int[] value_In) { IMolecularFormula mf = builder.newInstance(IMolecularFormula.class); for (int i = 0; i < isoToCond_new.size(); i++) { if (value_In[i] != 0) { for (int j = 0; j < value_In[i]; j++) ...
java
{ "resource": "" }
q157221
MassToFormulaTool.putInOrder
train
private IMolecularFormula putInOrder(IMolecularFormula formula) { IMolecularFormula new_formula = formula.getBuilder().newInstance(IMolecularFormula.class); for (int i = 0; i < orderElements.length; i++) { IElement element = builder.newInstance(IElement.class, orderElements[i]); ...
java
{ "resource": "" }
q157222
MassToFormulaTool.calculateMassT
train
private double calculateMassT(List<IIsotope> isoToCond_new, int[] value_In) { double result = 0; for (int i = 0; i < isoToCond_new.size(); i++) { if (value_In[i] != 0) { result += isoToCond_new.get(i).getExactMass() * value_In[i]; } } return result...
java
{ "resource": "" }
q157223
MassToFormulaTool.returnOrdered
train
private IMolecularFormulaSet returnOrdered(double mass, IMolecularFormulaSet formulaSet) { IMolecularFormulaSet solutions_new = null; if (formulaSet.size() != 0) { double valueMin = 100; int i_final = 0; solutions_new = formulaSet.getBuilder().newInstance(IMolecular...
java
{ "resource": "" }
q157224
MassToFormulaTool.getMatrix
train
private int[][] getMatrix(int size) { logger.info("Creating matrix for isotopes combination"); int lengthM = (int) Math.pow(2, size); lengthM--;// less 1 because the matrix 00000 we don't need int[][] matrix = new int[lengthM][size]; int[] combi = new int[size]; for (in...
java
{ "resource": "" }
q157225
ChemFileManipulator.getAtomCount
train
public static int getAtomCount(IChemFile file) { int count = 0; for (int i = 0; i < file.getChemSequenceCount(); i++) { count += ChemSequenceManipulator.getAtomCount(file.getChemSequence(i)); } return count; }
java
{ "resource": "" }
q157226
ChemFileManipulator.getBondCount
train
public static int getBondCount(IChemFile file) { int count = 0; for (int i = 0; i < file.getChemSequenceCount(); i++) { count += ChemSequenceManipulator.getBondCount(file.getChemSequence(i)); } return count; }
java
{ "resource": "" }
q157227
ChemFileManipulator.getAllChemObjects
train
public static List<IChemObject> getAllChemObjects(IChemFile file) { List<IChemObject> list = new ArrayList<IChemObject>(); //list.add(file); // should not add the original file for (int i = 0; i < file.getChemSequenceCount(); i++) { list.add(file.getChemSequence(i)); list...
java
{ "resource": "" }
q157228
ChemFileManipulator.getAllAtomContainers
train
public static List<IAtomContainer> getAllAtomContainers(IChemFile file) { List<IAtomContainer> acList = new ArrayList<IAtomContainer>(); for (IChemSequence sequence : file.chemSequences()) { acList.addAll(ChemSequenceManipulator.getAllAtomContainers(sequence)); } return acLis...
java
{ "resource": "" }
q157229
ChemFileManipulator.getAllChemModels
train
public static List<IChemModel> getAllChemModels(IChemFile file) { List<IChemModel> modelsList = new ArrayList<IChemModel>(); for (int f = 0; f < file.getChemSequenceCount(); f++) { for (IChemModel model : file.getChemSequence(f).chemModels()) { modelsList.add(model); ...
java
{ "resource": "" }
q157230
ChemFileManipulator.getAllReactions
train
public static List<IReaction> getAllReactions(IChemFile file) { List<IReaction> reactonList = new ArrayList<IReaction>(); List<IChemModel> chemModel = getAllChemModels(file); for (int f = 0; f < chemModel.size(); f++) { for (IReaction reaction : chemModel.get(f).getReactionSet().reac...
java
{ "resource": "" }
q157231
AtomPlacer3D.getHybridisationState
train
private int getHybridisationState(IAtom atom1) { IBond.Order maxBondOrder = atom1.getMaxBondOrder(); // if (atom1.getFormalNeighbourCount() == 1 || maxBondOrder > 4) { if (atom1.getFormalNeighbourCount() == 1) { // WTF?? } else if (atom1.getFormalNeighbourCount() == ...
java
{ "resource": "" }
q157232
AtomPlacer3D.getDoubleBondConfiguration2D
train
private int getDoubleBondConfiguration2D(IBond bond, Point2d a, Point2d b, Point2d c, Point2d d) throws CDKException { if (bond.getOrder() != IBond.Order.DOUBLE) { return 0; } // no 2D coordinates or existing configuration if (a == null || b == null || c == null |...
java
{ "resource": "" }
q157233
AtomPlacer3D.getBondLengthValue
train
public double getBondLengthValue(String id1, String id2) { String dkey = ""; if (pSet.containsKey(("bond" + id1 + ";" + id2))) { dkey = "bond" + id1 + ";" + id2; } else if (pSet.containsKey(("bond" + id2 + ";" + id1))) { dkey = "bond" + id2 + ";" + id1; } else { ...
java
{ "resource": "" }
q157234
AtomPlacer3D.getNextUnplacedHeavyAtomWithAliphaticPlacedNeighbour
train
public IAtom getNextUnplacedHeavyAtomWithAliphaticPlacedNeighbour(IAtomContainer molecule) { Iterator<IBond> bonds = molecule.bonds().iterator(); while (bonds.hasNext()) { IBond bond = bonds.next(); if (bond.getBegin().getFlag(CDKConstants.ISPLACED) && !(bond.getEnd().getFlag(CDK...
java
{ "resource": "" }
q157235
AtomPlacer3D.getUnplacedHeavyAtom
train
IAtom getUnplacedHeavyAtom(IAtomContainer molecule) { for (IAtom atom : molecule.atoms()) { if (isUnplacedHeavyAtom(atom)) return atom; } return null; }
java
{ "resource": "" }
q157236
AtomPlacer3D.getNextPlacedHeavyAtomWithUnplacedAliphaticNeighbour
train
public IAtom getNextPlacedHeavyAtomWithUnplacedAliphaticNeighbour(IAtomContainer molecule) { Iterator<IBond> bonds = molecule.bonds().iterator(); while (bonds.hasNext()) { IBond bond = bonds.next(); IAtom atom0 = bond.getBegin(); IAtom atom1 = bond.getEnd(); ...
java
{ "resource": "" }
q157237
AtomPlacer3D.getFarthestAtom
train
public IAtom getFarthestAtom(Point3d refAtomPoint, IAtomContainer ac) { double distance = 0; IAtom atom = null; for (int i = 0; i < ac.getAtomCount(); i++) { if (ac.getAtom(i).getPoint3d() != null) { if (Math.abs(refAtomPoint.distance(ac.getAtom(i).getPoint3d())) > di...
java
{ "resource": "" }
q157238
AtomPlacer3D.getUnplacedRingHeavyAtom
train
public IAtom getUnplacedRingHeavyAtom(IAtomContainer molecule, IAtom atom) { List<IBond> bonds = molecule.getConnectedBondsList(atom); IAtom connectedAtom = null; for (IBond bond : bonds) { connectedAtom = bond.getOther(atom); if (isUnplacedHeavyAtom(connectedAtom) && con...
java
{ "resource": "" }
q157239
AtomPlacer3D.geometricCenterAllPlacedAtoms
train
public Point3d geometricCenterAllPlacedAtoms(IAtomContainer molecule) { IAtomContainer allPlacedAtoms = getAllPlacedAtoms(molecule); return GeometryUtil.get3DCenter(allPlacedAtoms); }
java
{ "resource": "" }
q157240
AtomPlacer3D.getPlacedHeavyAtom
train
public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atom) { List<IBond> bonds = molecule.getConnectedBondsList(atom); for (IBond bond : bonds) { IAtom connectedAtom = bond.getOther(atom); if (isPlacedHeavyAtom(connectedAtom)) { return connectedAtom; ...
java
{ "resource": "" }
q157241
AtomPlacer3D.getPlacedHeavyAtom
train
public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) { List<IBond> bonds = molecule.getConnectedBondsList(atomA); for (IBond bond : bonds) { IAtom connectedAtom = bond.getOther(atomA); if (isPlacedHeavyAtom(connectedAtom) && !connectedAtom.equals(ato...
java
{ "resource": "" }
q157242
AtomPlacer3D.getPlacedHeavyAtoms
train
public IAtomContainer getPlacedHeavyAtoms(IAtomContainer molecule, IAtom atom) { List<IBond> bonds = molecule.getConnectedBondsList(atom); IAtomContainer connectedAtoms = molecule.getBuilder().newInstance(IAtomContainer.class); IAtom connectedAtom = null; for (IBond bond : bonds) { ...
java
{ "resource": "" }
q157243
AtomPlacer3D.getAllPlacedAtoms
train
private IAtomContainer getAllPlacedAtoms(IAtomContainer molecule) { IAtomContainer placedAtoms = new AtomContainer(); for (int i = 0; i < molecule.getAtomCount(); i++) { if (molecule.getAtom(i).getFlag(CDKConstants.ISPLACED)) { placedAtoms.addAtom(molecule.getAtom(i)); ...
java
{ "resource": "" }
q157244
AtomPlacer3D.allHeavyAtomsPlaced
train
public boolean allHeavyAtomsPlaced(IAtomContainer ac) { for (int i = 0; i < ac.getAtomCount(); i++) { if (isUnplacedHeavyAtom(ac.getAtom(i))) { return false; } } return true; }
java
{ "resource": "" }
q157245
MannholdLogPDescriptor.calculate
train
@Override public DescriptorValue calculate(IAtomContainer atomContainer) { IAtomContainer ac = null; try { ac = (IAtomContainer) atomContainer.clone(); } catch (CloneNotSupportedException e) { return getDummyDescriptorValue(e); } int carbonCount = 0; ...
java
{ "resource": "" }
q157246
Geometry3DValidator.validateBond
train
@Override public ValidationReport validateBond(IBond subject) { ValidationReport report = new ValidationReport(); // only consider two atom bonds if (subject.getAtomCount() == 2) { double distance = subject.getBegin().getPoint3d().distance(subject.getEnd().getPoint3d()); ...
java
{ "resource": "" }
q157247
AbstractStereo.invapply
train
protected static <T> T[] invapply(T[] src, int[] perm) { T[] res = src.clone(); for (int i = 0; i < src.length; i++) res[i] = src[perm[i]]; return res; }
java
{ "resource": "" }
q157248
HighlightGenerator.createAtomHighlight
train
private static Shape createAtomHighlight(IAtom atom, double radius) { double x = atom.getPoint2d().x; double y = atom.getPoint2d().y; return new RoundRectangle2D.Double(x - radius, y - radius, 2 * radius, 2 * radius, 2 * radius, 2 * radius); }
java
{ "resource": "" }
q157249
HighlightGenerator.createBondHighlight
train
private static Shape createBondHighlight(IBond bond, double radius) { double x1 = bond.getBegin().getPoint2d().x; double x2 = bond.getEnd().getPoint2d().x; double y1 = bond.getBegin().getPoint2d().y; double y2 = bond.getEnd().getPoint2d().y; double dx = x2 - x1; double ...
java
{ "resource": "" }
q157250
HighlightGenerator.createPalette
train
public static Palette createPalette(final Color color, final Color... colors) { Color[] cs = new Color[colors.length + 1]; cs[0] = color; System.arraycopy(colors, 0, cs, 1, colors.length); return new FixedPalette(cs); }
java
{ "resource": "" }
q157251
IVector.sub
train
public IVector sub(IVector b) { IVector result = new IVector(size); sub(b, result); return result; }
java
{ "resource": "" }
q157252
IVector.dot
train
public Complex dot(IVector b) { if ((b == null) || (size != b.size)) return new Complex(Double.NaN, Double.NaN); Complex result = new Complex(0d, 0d); int i; for (i = 0; i < size; i++) { result.real += realvector[i] * b.realvector[i] - imagvector[i] * b.imagvector[i]; ...
java
{ "resource": "" }
q157253
IVector.duplicate
train
public void duplicate(IVector result) { if (result.size != size) result.reshape(size); int i; for (i = 0; i < size; i++) { result.realvector[i] = realvector[i]; result.imagvector[i] = imagvector[i]; } }
java
{ "resource": "" }
q157254
IVector.reshape
train
public void reshape(int newsize) { if ((newsize == size) || (newsize <= 0)) return; double[] newrealvector = new double[newsize]; double[] newimagvector = new double[newsize]; int min = Math.min(size, newsize); int i; for (i = 0; i < min; i++) { newrealvector...
java
{ "resource": "" }
q157255
InChIGenerator.getInchiKey
train
public String getInchiKey() throws CDKException { JniInchiOutputKey key; try { key = JniInchiWrapper.getInchiKey(output.getInchi()); if (key.getReturnStatus() == INCHI_KEY.OK) { return key.getKey(); } else { throw new CDKException("Erro...
java
{ "resource": "" }
q157256
CMLModuleStack.push
train
public void push(ICMLModule item) { if (sp == stack.length) { ICMLModule[] temp = new ICMLModule[2 * sp]; System.arraycopy(stack, 0, temp, 0, sp); stack = temp; } stack[sp++] = item; }
java
{ "resource": "" }
q157257
AtomContainerDiscretePartitionRefinerImpl.getAutomorphismGroup
train
public PermutationGroup getAutomorphismGroup(IAtomContainer atomContainer, Partition initialPartition) { setup(atomContainer); super.refine(initialPartition); return super.getAutomorphismGroup(); }
java
{ "resource": "" }
q157258
InductivePartialCharges.assignInductivePartialCharges
train
public IAtomContainer assignInductivePartialCharges(IAtomContainer ac) throws Exception { if (factory == null) { factory = AtomTypeFactory .getInstance("org/openscience/cdk/config/data/jmol_atomtypes.txt", ac.getBuilder()); } int stepsLimit = 9; IAtom[] a...
java
{ "resource": "" }
q157259
InductivePartialCharges.getPaulingElectronegativities
train
public double[] getPaulingElectronegativities(IAtomContainer ac, boolean modified) throws CDKException { double[] paulingElectronegativities = new double[ac.getAtomCount()]; IElement element = null; String symbol = null; int atomicNumber = 0; try { ifac = Isotopes.get...
java
{ "resource": "" }
q157260
InductivePartialCharges.getAtomicSoftnessCore
train
public double getAtomicSoftnessCore(IAtomContainer ac, int atomPosition) throws CDKException { if (factory == null) { factory = AtomTypeFactory .getInstance("org/openscience/cdk/config/data/jmol_atomtypes.txt", ac.getBuilder()); } IAtom target = null; doub...
java
{ "resource": "" }
q157261
InductivePartialCharges.getAtomicChargeIncrement
train
private double getAtomicChargeIncrement(IAtomContainer ac, int atomPosition, double[] ElEn, int as) throws CDKException { IAtom[] allAtoms = null; IAtom target = null; double incrementedCharge = 0; double radiusTarget = 0; target = ac.getAtom(atomPosition); //...
java
{ "resource": "" }
q157262
InductivePartialCharges.getCovalentRadius
train
private double getCovalentRadius(String symbol, IBond.Order maxBondOrder) { double radiusTarget = 0; if (symbol.equals("F")) { radiusTarget = 0.64; } else if (symbol.equals("Cl")) { radiusTarget = 0.99; } else if (symbol.equals("Br")) { radiusTarget = ...
java
{ "resource": "" }
q157263
IsProtonInAromaticSystemDescriptor.calculate
train
@Override public DescriptorValue calculate(IAtom atom, IAtomContainer atomContainer) { IAtomContainer clonedAtomContainer; try { clonedAtomContainer = (IAtomContainer) atomContainer.clone(); } catch (CloneNotSupportedException e) { return new DescriptorValue(getSpecif...
java
{ "resource": "" }
q157264
MACCSFingerprinter.keys
train
private MaccsKey[] keys(final IChemObjectBuilder builder) throws CDKException { MaccsKey[] result = keys; if (result == null) { synchronized (lock) { result = keys; if (result == null) { try { keys = result = readKey...
java
{ "resource": "" }
q157265
MACCSFingerprinter.createPattern
train
private Pattern createPattern(String smarts, IChemObjectBuilder builder) throws IOException { SmartsPattern ptrn = SmartsPattern.create(smarts, builder); ptrn.setPrepare(false); // avoid redoing aromaticity etc return ptrn; }
java
{ "resource": "" }
q157266
EventCMLReader.process
train
public void process() throws CDKException { logger.debug("Started parsing from input..."); try { parser.setFeature("http://xml.org/sax/features/validation", false); logger.info("Deactivated validation"); } catch (SAXException e) { logger.warn("Cannot deactivat...
java
{ "resource": "" }
q157267
Reaction.addReactant
train
@Override public void addReactant(IAtomContainer reactant, Double coefficient) { reactants.addAtomContainer(reactant, coefficient); notifyChanged(); }
java
{ "resource": "" }
q157268
Reaction.setReactantCoefficients
train
@Override public boolean setReactantCoefficients(Double[] coefficients) { boolean result = reactants.setMultipliers(coefficients); notifyChanged(); return result; }
java
{ "resource": "" }
q157269
Reaction.setProductCoefficients
train
@Override public boolean setProductCoefficients(Double[] coefficients) { boolean result = products.setMultipliers(coefficients); notifyChanged(); return result; }
java
{ "resource": "" }
q157270
Reaction.addMapping
train
@Override public void addMapping(IMapping mapping) { if (mappingCount + 1 >= map.length) growMappingArray(); map[mappingCount] = mapping; mappingCount++; notifyChanged(); }
java
{ "resource": "" }
q157271
Reaction.removeMapping
train
@Override public void removeMapping(int pos) { for (int i = pos; i < mappingCount - 1; i++) { map[i] = map[i + 1]; } map[mappingCount - 1] = null; mappingCount--; notifyChanged(); }
java
{ "resource": "" }
q157272
MolecularFormulaRangeManipulator.getRange
train
public static MolecularFormulaRange getRange(IMolecularFormulaSet mfSet) { MolecularFormulaRange mfRange = new MolecularFormulaRange(); for (IMolecularFormula mf : mfSet.molecularFormulas()) { for (IIsotope isotope : mf.isotopes()) { int occur_new = mf.getIsotopeCount(isotop...
java
{ "resource": "" }
q157273
MolecularFormulaRangeManipulator.getMaximalFormula
train
public static IMolecularFormula getMaximalFormula(MolecularFormulaRange mfRange, IChemObjectBuilder builder) { IMolecularFormula formula = builder.newInstance(IMolecularFormula.class); for (IIsotope isotope : mfRange.isotopes()) { formula.addIsotope(isotope, mfRange.getIsotopeCountMax(isoto...
java
{ "resource": "" }
q157274
MolecularFormulaRangeManipulator.getMinimalFormula
train
public static IMolecularFormula getMinimalFormula(MolecularFormulaRange mfRange, IChemObjectBuilder builder) { IMolecularFormula formula = builder.newInstance(IMolecularFormula.class); for (IIsotope isotope : mfRange.isotopes()) { formula.addIsotope(isotope, mfRange.getIsotopeCountMin(isoto...
java
{ "resource": "" }
q157275
AbstractAWTDrawVisitor.transformPoint
train
public int[] transformPoint(double xCoord, double yCoord) { double[] src = new double[]{xCoord, yCoord}; double[] dest = new double[2]; this.transform.transform(src, 0, dest, 0, 1); return new int[]{(int) dest[0], (int) dest[1]}; }
java
{ "resource": "" }
q157276
AbstractAWTDrawVisitor.getTextBounds
train
protected Rectangle2D getTextBounds(String text, double xCoord, double yCoord, Graphics2D graphics) { FontMetrics fontMetrics = graphics.getFontMetrics(); Rectangle2D bounds = fontMetrics.getStringBounds(text, graphics); double widthPad = 3; double heightPad = 1; double width =...
java
{ "resource": "" }
q157277
LargestChainDescriptor.getParameters
train
@Override public Object[] getParameters() { // return the parameters as used for the descriptor calculation Object[] params = new Object[2]; params[0] = checkAromaticity; params[1] = checkRingSystem; return params; }
java
{ "resource": "" }
q157278
SmartsFragmentExtractor.setMode
train
public void setMode(int mode) { // check arg switch (mode) { case MODE_EXACT: case MODE_JCOMPOUNDMAPPER: break; default: throw new IllegalArgumentException("Invalid mode specified!"); } this.mode = mode; // re-g...
java
{ "resource": "" }
q157279
SmartsFragmentExtractor.generate
train
public String generate(int[] atomIdxs) { if (atomIdxs == null) throw new NullPointerException("No atom indexes provided"); if (atomIdxs.length == 0) return null; // makes sense? // special case if (atomIdxs.length == 1 && mode == MODE_EXACT) return a...
java
{ "resource": "" }
q157280
SmartsFragmentExtractor.encodeExpr
train
private void encodeExpr(int idx, int bprev, StringBuilder sb) { avisit[idx] = numVisit++; sb.append(aexpr[idx]); final int d = deg[idx]; int remain = d; for (int j = 0; j < d; j++) { int nbr = atomAdj[idx][j]; int bidx = bondAdj[idx][j]; // r...
java
{ "resource": "" }
q157281
SmartsFragmentExtractor.chooseRingNumber
train
private int chooseRingNumber() { for (int i = 1; i < rnums.length; i++) { if (rnums[i] == 0) { rnums[i] = 1; return i; } } throw new IllegalStateException("No more ring numbers available!"); }
java
{ "resource": "" }
q157282
MoleculeGraphs.getMoleculeGraph
train
static public SimpleGraph getMoleculeGraph(IAtomContainer molecule) { SimpleGraph graph = new SimpleGraph(); for (int i = 0; i < molecule.getAtomCount(); i++) { IAtom atom = molecule.getAtom(i); graph.addVertex(atom); } for (int i = 0; i < molecule.getBondCount()...
java
{ "resource": "" }
q157283
TaeAminoAcidDescriptor.calculate
train
@Override public DescriptorValue calculate(IAtomContainer container) { if (taeParams == null) return getDummyDescriptorValue(new CDKException("TAE parameters were not initialized")); if (!(container instanceof IBioPolymer)) return getDummyDescriptorValue(new CDKException("The molecule sh...
java
{ "resource": "" }
q157284
MacroCycleLayout.getAttachedInOrder
train
private List<Integer> getAttachedInOrder(IRing macrocycle, IAtomContainer shared) { List<Integer> ringAttach = new ArrayList<>(); Set<IAtom> visit = new HashSet<>(); IAtom atom = shared.getAtom(0); while (atom != null) { visit.add(atom); ringAttach.add(macrocycle....
java
{ "resource": "" }
q157285
MacroCycleLayout.selectCoords
train
private int selectCoords(Collection<Point2d[]> ps, Point2d[] coords, IRing macrocycle, IRingSet ringset) { assert ps.size() != 0; final int[] winding = new int[coords.length]; MacroScore best = null; for (Point2d[] p : ps) { final int wind = winding(p, winding); ...
java
{ "resource": "" }
q157286
MacroCycleLayout.winding
train
private static int winding(final Point2d[] coords, final int[] winding) { int cw = 0, ccw = 0; Point2d prev = coords[coords.length - 1]; for (int i = 0; i < coords.length; i++) { Point2d curr = coords[i]; Point2d next = coords[(i + 1) % coords.length]; windin...
java
{ "resource": "" }
q157287
MacroCycleLayout.winding
train
private static int winding(Point2d a, Point2d b, Point2d c) { return (int) Math.signum((b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x)); }
java
{ "resource": "" }
q157288
MacroCycleLayout.roundUpIfNeeded
train
private static IAtomContainer roundUpIfNeeded(IAtomContainer anon) { IChemObjectBuilder bldr = anon.getBuilder(); if ((anon.getAtomCount() & 0x1) != 0) { IBond bond = anon.removeBond(anon.getBondCount() - 1); IAtom dummy = bldr.newInstance(IAtom.class, "C"); anon.addA...
java
{ "resource": "" }
q157289
StructGenMatcher.findMatchingAtomType
train
@Override public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom) throws CDKException { if (factory == null) { try { factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/structgen_atomtypes.xml", atom.getBuilder())...
java
{ "resource": "" }
q157290
IPBondLearningDescriptor.calculate
train
@Override public DescriptorValue calculate(IBond bond, IAtomContainer atomContainer) { double value = 0; // FIXME: for now I'll cache a few modified atomic properties, and restore them at the end of this method String originalAtomtypeName1 = bond.getBegin().getAtomTypeName(); Integer...
java
{ "resource": "" }
q157291
BondRefinable.getInitialPartition
train
public Partition getInitialPartition() { int bondCount = atomContainer.getBondCount(); Map<String, SortedSet<Integer>> cellMap = new HashMap<String, SortedSet<Integer>>(); // make mini-'descriptors' for bonds like "C=O" or "C#N" etc for (int bondIndex = 0; bondIndex < bondCount; bondInd...
java
{ "resource": "" }
q157292
AtomTypeTools.ringSystemClassifier
train
private int ringSystemClassifier(IRing ring, String smile) throws CDKException { /* System.out.println("IN AtomTypeTools Smile:"+smile); */ logger.debug("Comparing ring systems: SMILES=", smile); if (PYRROLE_SMI == null) { final SmilesParser smipar = new SmilesParser(ring.ge...
java
{ "resource": "" }
q157293
QueryAtomContainer.setAtoms
train
@Override public void setAtoms(IAtom[] atoms) { this.atoms = atoms; for (IAtom atom : atoms) { atom.addListener(this); } this.atomCount = atoms.length; notifyChanged(); }
java
{ "resource": "" }
q157294
QueryAtomContainer.setBonds
train
@Override public void setBonds(IBond[] bonds) { this.bonds = bonds; for (IBond bond : bonds) { bond.addListener(this); } this.bondCount = bonds.length; }
java
{ "resource": "" }
q157295
QueryAtomContainer.getConnectedAtomsList
train
@Override public List<IAtom> getConnectedAtomsList(IAtom atom) { List<IAtom> atomsList = new ArrayList<IAtom>(); for (int i = 0; i < bondCount; i++) { if (bonds[i].contains(atom)) atomsList.add(bonds[i].getOther(atom)); } return atomsList; }
java
{ "resource": "" }
q157296
QueryAtomContainer.getConnectedBondsList
train
@Override public List<IBond> getConnectedBondsList(IAtom atom) { List<IBond> bondsList = new ArrayList<IBond>(); for (int i = 0; i < bondCount; i++) { if (bonds[i].contains(atom)) bondsList.add(bonds[i]); } return bondsList; }
java
{ "resource": "" }
q157297
QueryAtomContainer.getConnectedSingleElectronsList
train
@Override public List<ISingleElectron> getConnectedSingleElectronsList(IAtom atom) { List<ISingleElectron> lps = new ArrayList<ISingleElectron>(); for (int i = 0; i < singleElectronCount; i++) { if (singleElectrons[i].contains(atom)) lps.add(singleElectrons[i]); } return ...
java
{ "resource": "" }
q157298
QueryAtomContainer.getConnectedAtomsCount
train
@Override public int getConnectedAtomsCount(IAtom atom) { int count = 0; for (int i = 0; i < bondCount; i++) { if (bonds[i].contains(atom)) ++count; } return count; }
java
{ "resource": "" }
q157299
QueryAtomContainer.getConnectedLonePairsCount
train
@Override public int getConnectedLonePairsCount(IAtom atom) { int count = 0; for (int i = 0; i < lonePairCount; i++) { if (lonePairs[i].contains(atom)) ++count; } return count; }
java
{ "resource": "" }