_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q157400
RingSetManipulator.getAllAtomContainers
train
public static List<IAtomContainer> getAllAtomContainers(IRingSet set) { List<IAtomContainer> atomContainerList = new ArrayList<IAtomContainer>(); for (IAtomContainer atomContainer : set.atomContainers()) { atomContainerList.add(atomContainer); } return atomContainerList; ...
java
{ "resource": "" }
q157401
RingSetManipulator.sort
train
public static void sort(IRingSet ringSet) { List<IRing> ringList = new ArrayList<IRing>(); for (IAtomContainer atomContainer : ringSet.atomContainers()) { ringList.add((IRing) atomContainer); } Collections.sort(ringList, new RingSizeComparator(RingSizeComparator.SMALL_FIRST))...
java
{ "resource": "" }
q157402
RingSetManipulator.getHeaviestRing
train
public static IRing getHeaviestRing(IRingSet ringSet, IBond bond) { IRingSet rings = ringSet.getRings(bond); IRing ring = null; int maxOrderSum = 0; for (Object ring1 : rings.atomContainers()) { if (maxOrderSum < ((IRing) ring1).getBondOrderSum()) { ring = (IR...
java
{ "resource": "" }
q157403
RingSetManipulator.ringAlreadyInSet
train
public static boolean ringAlreadyInSet(IRing newRing, IRingSet ringSet) { IRing ring; // IBond[] bonds; // IBond[] newBonds; // IBond bond; int equalCount; boolean equals; for (int f = 0; f < ringSet.getAtomContainerCount(); f++) { equals = fa...
java
{ "resource": "" }
q157404
RingSetManipulator.markAromaticRings
train
public static void markAromaticRings(IRingSet ringset) { for (IAtomContainer atomContainer : ringset.atomContainers()) { RingManipulator.markAromaticRings((IRing) atomContainer); } }
java
{ "resource": "" }
q157405
SingleStructureRandomGenerator.generate
train
public IAtomContainer generate() throws CDKException { boolean structureFound = false; boolean bondFormed; double order; double max, cmax1, cmax2; int iteration = 0; IAtom partner; IAtom atom; do { iteration++; atomContainer.removeA...
java
{ "resource": "" }
q157406
SingleStructureRandomGenerator.getAnotherUnsaturatedNode
train
private IAtom getAnotherUnsaturatedNode(IAtom exclusionAtom) throws CDKException { IAtom atom; int next = random.nextInt(atomContainer.getAtomCount()); for (int f = next; f < atomContainer.getAtomCount(); f++) { atom = atomContainer.getAtom(f); if (!satCheck.isSaturated(...
java
{ "resource": "" }
q157407
DeduceBondSystemTool.isOK
train
public boolean isOK(IAtomContainer m) throws CDKException { // OK, we take advantage here from the fact that this class does not take // into account rings larger than 7 atoms. See fixAromaticBondOrders(). IRingSet rs = allRingsFinder.findAllRings(m, 7); storeRingSystem(m, rs); b...
java
{ "resource": "" }
q157408
DeduceBondSystemTool.fixAromaticBondOrders
train
public IAtomContainer fixAromaticBondOrders(IAtomContainer atomContainer) throws CDKException { // preset all bond orders to single for (IBond bond : atomContainer.bonds()) { if (bond.isAromatic() && bond.getOrder() == IBond.Order.UNSET) bond.setOrder(IBond.Order.SINGLE); ...
java
{ "resource": "" }
q157409
DeduceBondSystemTool.removeExtraRings
train
private IRingSet removeExtraRings(IAtomContainer m) { try { IRingSet rs = Cycles.sssr(m).toRingSet(); //remove rings which dont have all aromatic atoms (according to hybridization set by lower case symbols in smiles): //logger.debug("numrings="+rs.size()); ilo...
java
{ "resource": "" }
q157410
DeduceBondSystemTool.storeRingSystem
train
private void storeRingSystem(IAtomContainer mol, IRingSet ringSet) { listOfRings = new ArrayList<Integer[]>(); // this is a list of int arrays for (int r = 0; r < ringSet.getAtomContainerCount(); ++r) { IRing ring = (IRing) ringSet.getAtomContainer(r); Integer[] bondNumbers = new...
java
{ "resource": "" }
q157411
ElementRule.setParameters
train
@Override public void setParameters(Object[] params) throws CDKException { if (params.length != 1) throw new CDKException("ElementRule expects one parameters"); if (!(params[0] == null || params[0] instanceof MolecularFormulaRange)) throw new CDKException("The parameter must be of type ...
java
{ "resource": "" }
q157412
ElementRule.ensureDefaultOccurElements
train
private void ensureDefaultOccurElements(IChemObjectBuilder builder) { if (mfRange == null) { String[] elements = new String[]{"C", "H", "O", "N", "Si", "P", "S", "F", "Cl", "Br", "I", "Sn", "B", "Pb", "Tl", "Ba", "In", "Pd", "Pt", "Os", "Ag", "Zr", "Se", "Zn", "Cu", "Ni", "Co", "...
java
{ "resource": "" }
q157413
JumboCyclicVertexSearch.vertexColor
train
@Override public int[] vertexColor() { int[] result = colors; if (result == null) { synchronized (this) { result = colors; if (result == null) { colors = result = buildVertexColor(); } } } ret...
java
{ "resource": "" }
q157414
JumboCyclicVertexSearch.xor
train
static BitSet xor(BitSet x, BitSet y) { BitSet z = copy(x); z.xor(y); return z; }
java
{ "resource": "" }
q157415
JumboCyclicVertexSearch.and
train
static BitSet and(BitSet x, BitSet y) { BitSet z = copy(x); z.and(y); return z; }
java
{ "resource": "" }
q157416
JumboCyclicVertexSearch.copy
train
static BitSet copy(BitSet org) { BitSet cpy = (BitSet) org.clone(); return cpy; }
java
{ "resource": "" }
q157417
OWLAtomTypeMappingReader.readAtomTypeMappings
train
public Map<String, String> readAtomTypeMappings() { Map<String, String> mappings = null; try { parser.setFeature("http://xml.org/sax/features/validation", false); logger.info("Deactivated validation"); } catch (SAXException exception) { logger.warn("Cannot dea...
java
{ "resource": "" }
q157418
TemplateHandler3D.loadTemplates
train
private void loadTemplates() throws CDKException { try (InputStream gin = getClass().getResourceAsStream(TEMPLATE_PATH); InputStream in = new GZIPInputStream(gin); IteratingSDFReader sdfr = new IteratingSDFReader(in, builder)) { while (sdfr.hasNext()) { fina...
java
{ "resource": "" }
q157419
TemplateHandler3D.mapTemplates
train
public void mapTemplates(IAtomContainer mol, int numberOfRingAtoms) throws CDKException, CloneNotSupportedException { if (templates.isEmpty()) loadTemplates(); IAtomContainer best = null; Map<IChemObject, IChemObject> bestMap = null; IAt...
java
{ "resource": "" }
q157420
SaturationChecker.isSaturated
train
@Override public boolean isSaturated(IAtom atom, IAtomContainer ac) throws CDKException { IAtomType[] atomTypes = getAtomTypeFactory(atom.getBuilder()).getAtomTypes(atom.getSymbol()); if (atomTypes.length == 0) return true; double bondOrderSum = ac.getBondOrderSum(atom); IBond.Order ...
java
{ "resource": "" }
q157421
SaturationChecker.getCurrentMaxBondOrder
train
public double getCurrentMaxBondOrder(IAtom atom, IAtomContainer ac) throws CDKException { IAtomType[] atomTypes = getAtomTypeFactory(atom.getBuilder()).getAtomTypes(atom.getSymbol()); if (atomTypes.length == 0) return 0; double bondOrderSum = ac.getBondOrderSum(atom); Integer hcount = at...
java
{ "resource": "" }
q157422
SaturationChecker.unsaturate
train
public void unsaturate(IAtomContainer atomContainer) { for (IBond bond : atomContainer.bonds()) bond.setOrder(Order.SINGLE); }
java
{ "resource": "" }
q157423
SaturationChecker.unsaturateBonds
train
public void unsaturateBonds(IAtomContainer container) { for (IBond bond : container.bonds()) bond.setOrder(Order.SINGLE); }
java
{ "resource": "" }
q157424
SaturationChecker.newSaturate
train
public void newSaturate(IAtomContainer atomContainer) throws CDKException { logger.info("Saturating atomContainer by adjusting bond orders..."); boolean allSaturated = allSaturated(atomContainer); if (!allSaturated) { IBond[] bonds = new IBond[atomContainer.getBondCount()]; ...
java
{ "resource": "" }
q157425
SaturationChecker.newSaturate
train
public boolean newSaturate(IBond[] bonds, IAtomContainer atomContainer) throws CDKException { logger.debug("Saturating bond set of size: " + bonds.length); boolean bondsAreFullySaturated = true; if (bonds.length > 0) { IBond bond = bonds[0]; // determine bonds left ...
java
{ "resource": "" }
q157426
AtomContainerSet.setMultiplier
train
@Override public boolean setMultiplier(IAtomContainer container, Double multiplier) { for (int i = 0; i < atomContainers.length; i++) { if (atomContainers[i] == container) { multipliers[i] = multiplier; return true; } } return false; ...
java
{ "resource": "" }
q157427
IDCreator.createIDs
train
public static void createIDs(IChemObject chemObject) { if (chemObject == null) return; resetCounters(); if (chemObject instanceof IAtomContainer) { createIDsForAtomContainer((IAtomContainer) chemObject, null); } else if (chemObject instanceof IAtomContainerSet) { ...
java
{ "resource": "" }
q157428
IDCreator.resetCounters
train
private static void resetCounters() { atomCount = 0; bondCount = 0; atomContainerCount = 0; atomContainerSetCount = 0; reactionCount = 0; reactionSetCount = 0; chemModelCount = 0; chemSequenceCount = 0; chemFileCount = 0; }
java
{ "resource": "" }
q157429
IDCreator.setID
train
private static int setID(String prefix, int identifier, IChemObject object, List<String> tabuList) { identifier += 1; while (tabuList.contains(prefix + identifier)) { identifier += 1; } object.setID(prefix + identifier); tabuList.add(prefix + identifier); retu...
java
{ "resource": "" }
q157430
IDCreator.createIDsForAtomContainer
train
private static void createIDsForAtomContainer(IAtomContainer container, List<String> tabuList) { if (tabuList == null) tabuList = AtomContainerManipulator.getAllIDs(container); if (null == container.getID()) { // generate new ID and remember it atomContainerCount = setID(ATOMCON...
java
{ "resource": "" }
q157431
IDCreator.createIDsForAtomContainerSet
train
private static void createIDsForAtomContainerSet(IAtomContainerSet containerSet, List<String> tabuList) { if (tabuList == null) tabuList = AtomContainerSetManipulator.getAllIDs(containerSet); if (null == containerSet.getID()) { atomContainerSetCount = setID(ATOMCONTAINERSET_PREFIX, atomCont...
java
{ "resource": "" }
q157432
IDCreator.createIDsForReaction
train
private static void createIDsForReaction(IReaction reaction, List<String> tabuList) { if (tabuList == null) tabuList = ReactionManipulator.getAllIDs(reaction); if (null == reaction.getID()) { // generate new ID reactionCount = setID(REACTION_PREFIX, reactionCount , reaction, ta...
java
{ "resource": "" }
q157433
ProtonTotalPartialChargeDescriptor.calculate
train
@Override public DescriptorValue calculate(IAtom atom, IAtomContainer ac) { neighboors = ac.getConnectedAtomsList(atom); IAtomContainer clone; try { clone = (IAtomContainer) ac.clone(); } catch (CloneNotSupportedException e) { return getDummyDescriptorValue(e...
java
{ "resource": "" }
q157434
OptionIOSetting.setSetting
train
@Override public void setSetting(String setting) throws CDKException { if (settings.contains(setting)) { this.setting = setting; } else { throw new CDKException("Setting " + setting + " is not allowed."); } }
java
{ "resource": "" }
q157435
OptionIOSetting.setSetting
train
public void setSetting(int setting) throws CDKException { if (setting < settings.size() + 1 && setting > 0) { this.setting = (String) settings.get(setting - 1); } else { throw new CDKException("Setting " + setting + " does not exist."); } }
java
{ "resource": "" }
q157436
SMILESWriter.write
train
@Override public void write(IChemObject object) throws CDKException { if (object instanceof IAtomContainerSet) { writeAtomContainerSet((IAtomContainerSet) object); } else if (object instanceof IAtomContainer) { writeAtomContainer((IAtomContainer) object); } else { ...
java
{ "resource": "" }
q157437
SMILESWriter.writeAtomContainerSet
train
public void writeAtomContainerSet(IAtomContainerSet som) { writeAtomContainer(som.getAtomContainer(0)); for (int i = 1; i <= som.getAtomContainerCount() - 1; i++) { try { writeAtomContainer(som.getAtomContainer(i)); } catch (Exception exc) { } ...
java
{ "resource": "" }
q157438
SMILESWriter.writeAtomContainer
train
public void writeAtomContainer(IAtomContainer molecule) { SmilesGenerator sg = new SmilesGenerator(); if (useAromaticityFlag.isSet()) sg = sg.aromatic(); String smiles = ""; try { smiles = sg.create(molecule); logger.debug("Generated SMILES: " + smiles); ...
java
{ "resource": "" }
q157439
BondsToAtomDescriptor.calculate
train
@Override public DescriptorValue calculate(IAtom atom, IAtomContainer container) { IAtom focus = container.getAtom(focusPosition); // could be cached int bondsToAtom = new ShortestPaths(container, atom).distanceTo(focus); return new DescriptorValue(getSpecification(), getParameter...
java
{ "resource": "" }
q157440
CDKHydrogenAdder.addImplicitHydrogens
train
public void addImplicitHydrogens(IAtomContainer container) throws CDKException { for (IAtom atom : container.atoms()) { if (!(atom instanceof IPseudoAtom)) { addImplicitHydrogens(container, atom); } } }
java
{ "resource": "" }
q157441
CDKHydrogenAdder.addImplicitHydrogens
train
public void addImplicitHydrogens(IAtomContainer container, IAtom atom) throws CDKException { if (atom.getAtomTypeName() == null) throw new CDKException("IAtom is not typed! " + atom.getSymbol()); if ("X".equals(atom.getAtomTypeName())) { if (atom.getImplicitHydrogenCount() == null) atom.set...
java
{ "resource": "" }
q157442
RangeMassDecomposer.init
train
private void init() { if (ERTs != null) return; synchronized (this) { if (ERTs != null) return; discretizeMasses(); divideByGCD(); computeLCMs(); calcERT(); computeErrors(); } }
java
{ "resource": "" }
q157443
RangeMassDecomposer.decomposeIterator
train
DecompIterator decomposeIterator(double from, double to, MolecularFormulaRange boundaries) { init(); if (to < 0d || from < 0d) throw new IllegalArgumentException("Expect positive mass for decomposition: [" + from + ", " + to + "]"); if (to < from) throw new IllegalArgumentException("...
java
{ "resource": "" }
q157444
RangeMassDecomposer.calcERT
train
private void calcERT(int deviation) { final int[][][] ERTs = this.ERTs; final int currentLength = ERTs.length; // we have to extend the ERT table int[][] lastERT = ERTs[ERTs.length - 1]; int[][] nextERT = new int[lastERT.length][weights.size()]; if (currentLength == 1) ...
java
{ "resource": "" }
q157445
ReactionSet.addReaction
train
@Override public void addReaction(IReaction reaction) { if (reactionCount + 1 >= reactions.length) growReactionArray(); reactions[reactionCount] = reaction; reactionCount++; }
java
{ "resource": "" }
q157446
ReactionSet.removeAllReactions
train
@Override public void removeAllReactions() { for (int pos = this.reactionCount - 1; pos >= 0; pos--) { this.reactions[pos] = null; } this.reactionCount = 0; }
java
{ "resource": "" }
q157447
PiBondingMovementReaction.setActiveCenters
train
private void setActiveCenters(IAtomContainer reactant) throws CDKException { AllRingsFinder arf = new AllRingsFinder(); IRingSet ringSet = arf.findAllRings(reactant); for (int ir = 0; ir < ringSet.getAtomContainerCount(); ir++) { IRing ring = (IRing) ringSet.getAtomContainer(ir); ...
java
{ "resource": "" }
q157448
RandomGenerator.proposeStructure
train
public IAtomContainer proposeStructure() { logger.debug("RandomGenerator->proposeStructure() Start"); do { try { trial = molecule.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Could not clone IAtomContainer!" + ...
java
{ "resource": "" }
q157449
HBondDonorCountDescriptor.calculate
train
@Override public DescriptorValue calculate(IAtomContainer atomContainer) { int hBondDonors = 0; IAtomContainer ac; try { ac = (IAtomContainer) atomContainer.clone(); } catch (CloneNotSupportedException e) { return getDummyDescriptorValue(e); } ...
java
{ "resource": "" }
q157450
RegularCyclicVertexSearch.buildVertexColor
train
private int[] buildVertexColor() { int[] color = new int[g.length]; int n = 1; Arrays.fill(color, -1); for (long cycle : cycles) { for (int i = 0; i < g.length; i++) { if ((cycle & 0x1) == 0x1) color[i] = color[i] < 0 ? n : 0; cycle >>= 1; ...
java
{ "resource": "" }
q157451
IsotopeFactory.getSize
train
public int getSize() { int count = 0; for (List<IIsotope> isotope : isotopes) if (isotope != null) count += isotope.size(); return count; }
java
{ "resource": "" }
q157452
IsotopeFactory.add
train
protected void add(IIsotope isotope) { Integer atomicNum = isotope.getAtomicNumber(); assert atomicNum != null; List<IIsotope> isotopesForElement = isotopes[atomicNum]; if (isotopesForElement == null) { isotopesForElement = new ArrayList<>(); isotopes[atomicNum] =...
java
{ "resource": "" }
q157453
IsotopeFactory.getIsotopes
train
public IIsotope[] getIsotopes(int elem) { if (isotopes[elem] == null) return EMPTY_ISOTOPE_ARRAY; List<IIsotope> list = new ArrayList<>(); for (IIsotope isotope : isotopes[elem]) { list.add(clone(isotope)); } return list.toArray(new IIsotope[0]); }
java
{ "resource": "" }
q157454
IsotopeFactory.getIsotopes
train
public IIsotope[] getIsotopes() { List<IIsotope> list = new ArrayList<IIsotope>(); for (List<IIsotope> isotopes : this.isotopes) { if (isotopes == null) continue; for (IIsotope isotope : isotopes) { list.add(clone(isotope)); } } return ...
java
{ "resource": "" }
q157455
IsotopeFactory.getIsotopes
train
public IIsotope[] getIsotopes(double exactMass, double difference) { List<IIsotope> list = new ArrayList<>(); for (List<IIsotope> isotopes : this.isotopes) { if (isotopes == null) continue; for (IIsotope isotope : isotopes) { if (Math.abs(isotope.getExactMass() - ...
java
{ "resource": "" }
q157456
IsotopeFactory.getIsotope
train
public IIsotope getIsotope(String symbol, int massNumber) { int elem = Elements.ofString(symbol).number(); List<IIsotope> isotopes = this.isotopes[elem]; if (isotopes == null) return null; for (IIsotope isotope : isotopes) { if (isotope.getSymbol().equals(symbol) ...
java
{ "resource": "" }
q157457
IsotopeFactory.getIsotope
train
public IIsotope getIsotope(String symbol, double exactMass, double tolerance) { IIsotope ret = null; double minDiff = Double.MAX_VALUE; int elem = Elements.ofString(symbol).number(); List<IIsotope> isotopes = this.isotopes[elem]; if (isotopes == null) return null; ...
java
{ "resource": "" }
q157458
IsotopeFactory.getExactMass
train
public double getExactMass(Integer atomicNumber, Integer massNumber) { if (atomicNumber == null || massNumber == null) return 0; for (IIsotope isotope : this.isotopes[atomicNumber]) { if (isotope.getMassNumber().equals(massNumber)) return isotope.getExactMass(); ...
java
{ "resource": "" }
q157459
IsotopeFactory.configure
train
public IAtom configure(IAtom atom, IIsotope isotope) { atom.setMassNumber(isotope.getMassNumber()); atom.setSymbol(isotope.getSymbol()); atom.setExactMass(isotope.getExactMass()); atom.setAtomicNumber(isotope.getAtomicNumber()); atom.setNaturalAbundance(isotope.getNaturalAbundanc...
java
{ "resource": "" }
q157460
IsotopeFactory.configureAtoms
train
public void configureAtoms(IAtomContainer container) { for (int f = 0; f < container.getAtomCount(); f++) { configure(container.getAtom(f)); } }
java
{ "resource": "" }
q157461
IsotopeFactory.getNaturalMass
train
public double getNaturalMass(int atomicNum) { List<IIsotope> isotopes = this.isotopes[atomicNum]; if (isotopes == null) return 0; double summedAbundances = 0; double summedWeightedAbundances = 0; double getNaturalMass = 0; for (IIsotope isotope : isotopes) { ...
java
{ "resource": "" }
q157462
Congestion.initScore
train
private double initScore() { double score = 0; final int n = atoms.length; for (int i = 0; i < n; i++) { final Point2d p1 = atoms[i].getPoint2d(); for (int j = i + 1; j < n; j++) { if (contribution[i][j] < 0) continue; final Point2d p2 = at...
java
{ "resource": "" }
q157463
Congestion.update
train
void update(boolean[] visit, int[] vs, int n) { int len = atoms.length; double subtract = 0; for (int i = 0; i < n; i++) { final int v = vs[i]; final Point2d p1 = atoms[v].getPoint2d(); for (int w = 0; w < len; w++) { if (visit[w] || contributi...
java
{ "resource": "" }
q157464
AllCycles.verticesInOrder
train
static int[] verticesInOrder(final int[] rank) { int[] vs = new int[rank.length]; for (int v = 0; v < rank.length; v++) vs[rank[v]] = v; return vs; }
java
{ "resource": "" }
q157465
AllCycles.rank
train
static int[] rank(final int[][] g) { final int ord = g.length; final int[] count = new int[ord + 1]; final int[] rank = new int[ord]; // frequency of each degree for (int v = 0; v < ord; v++) count[g[v].length + 1]++; // cumulated counts for (int i =...
java
{ "resource": "" }
q157466
AllCycles.paths
train
public int[][] paths() { int[][] paths = new int[cycles.size()][]; for (int i = 0; i < cycles.size(); i++) paths[i] = cycles.get(i).clone(); return paths; }
java
{ "resource": "" }
q157467
DepictionGenerator.depict
train
public Depiction depict(Iterable<IAtomContainer> mols, int nrow, int ncol) throws CDKException { List<LayoutBackup> layoutBackups = new ArrayList<>(); int molId = 0; for (IAtomContainer mol : mols) { setIfMissing(mol, MarkedElement.ID_KEY, "mol" + ++molId); layoutBackups...
java
{ "resource": "" }
q157468
DepictionGenerator.makeHighlightAtomMap
train
private Map<IChemObject, Color> makeHighlightAtomMap(List<IAtomContainer> reactants, List<IAtomContainer> products) { Map<IChemObject, Color> colorMap = new HashMap<>(); Map<Integer, Color> mapToColor = new HashMap<>(); int colorIdx = -1; ...
java
{ "resource": "" }
q157469
DepictionGenerator.generateTitle
train
private Bounds generateTitle(IChemObject chemObj, double scale) { String title = chemObj.getProperty(CDKConstants.TITLE); if (title == null || title.isEmpty()) return new Bounds(); scale = 1 / scale * getParameterValue(RendererModel.TitleFontScale.class); return new Bounds(Ma...
java
{ "resource": "" }
q157470
DepictionGenerator.ensure2dLayout
train
private boolean ensure2dLayout(IAtomContainer container) throws CDKException { if (!GeometryUtil.has2DCoordinates(container)) { StructureDiagramGenerator sdg = new StructureDiagramGenerator(); sdg.generateCoordinates(container); return true; } return false; ...
java
{ "resource": "" }
q157471
DepictionGenerator.ensure2dLayout
train
private void ensure2dLayout(IReaction rxn) throws CDKException { if (!GeometryUtil.has2DCoordinates(rxn)) { StructureDiagramGenerator sdg = new StructureDiagramGenerator(); sdg.setAlignMappedReaction(alignMappedReactions); sdg.generateCoordinates(rxn); } }
java
{ "resource": "" }
q157472
DepictionGenerator.withOuterGlowHighlight
train
public DepictionGenerator withOuterGlowHighlight(double width) { return withParam(StandardGenerator.Highlighting.class, StandardGenerator.HighlightStyle.OuterGlow) .withParam(StandardGenerator.OuterGlowWidth.class, width); }
java
{ "resource": "" }
q157473
DepictionGenerator.withAtomNumbers
train
public DepictionGenerator withAtomNumbers() { if (annotateAtomMap || annotateAtomVal) throw new IllegalArgumentException("Can not annotated atom numbers, atom values or maps are already annotated"); DepictionGenerator copy = new DepictionGenerator(this); copy.annotateAtomNum = true; ...
java
{ "resource": "" }
q157474
DepictionGenerator.withAtomValues
train
public DepictionGenerator withAtomValues() { if (annotateAtomNum || annotateAtomMap) throw new IllegalArgumentException("Can not annotated atom values, atom numbers or maps are already annotated"); DepictionGenerator copy = new DepictionGenerator(this); copy.annotateAtomVal = true; ...
java
{ "resource": "" }
q157475
DepictionGenerator.withAtomMapHighlight
train
public DepictionGenerator withAtomMapHighlight(Color[] colors) { DepictionGenerator copy = new DepictionGenerator(this); copy.highlightAtomMap = true; copy.atomMapColors = Arrays.copyOf(colors, colors.length); return copy; }
java
{ "resource": "" }
q157476
DepictionGenerator.withHighlight
train
public DepictionGenerator withHighlight(Iterable<? extends IChemObject> chemObjs, Color color) { DepictionGenerator copy = new DepictionGenerator(this); for (IChemObject chemObj : chemObjs) copy.highlight.put(chemObj, color); return copy; }
java
{ "resource": "" }
q157477
DepictionGenerator.withParam
train
public <T extends IGeneratorParameter<S>, S, U extends S> DepictionGenerator withParam(Class<T> key, U value) { DepictionGenerator copy = new DepictionGenerator(this); copy.setParam(key, value); return copy; }
java
{ "resource": "" }
q157478
Orbitals.setCoefficients
train
public void setCoefficients(Matrix C) { if (count_basis == C.rows) { this.C = C; count_orbitals = C.columns; } }
java
{ "resource": "" }
q157479
Orbitals.getValues
train
public Vector getValues(int index, Matrix m) { if (m.rows != 3) return null; Vector result = basis.getValues(0, m).mul(C.matrix[0][index]); for (int i = 1; i < count_basis; i++) if (C.matrix[i][index] != 0d) result.add(basis.getValues(i, m).mul(C.matrix[0][index])); return r...
java
{ "resource": "" }
q157480
ConvexHull.ofShapes
train
public static ConvexHull ofShapes(final List<Shape> shapes) { final Path2D combined = new Path2D.Double(); for (Shape shape : shapes) combined.append(shape, false); return new ConvexHull(shapeOf(grahamScan(pointsOf(combined)))); }
java
{ "resource": "" }
q157481
ConvexHull.shapeOf
train
static Shape shapeOf(List<Point2D> points) { Path2D path = new Path2D.Double(); if (!points.isEmpty()) { path.moveTo(points.get(0).getX(), points.get(0).getY()); for (Point2D point : points) path.lineTo(point.getX(), point.getY()); path.closePath(); ...
java
{ "resource": "" }
q157482
ConvexHull.pointsOf
train
static List<Point2D> pointsOf(final Shape shape) { final List<Point2D> points = new ArrayList<Point2D>(); final double[] coordinates = new double[6]; for (PathIterator i = shape.getPathIterator(null); !i.isDone(); i.next()) { switch (i.currentSegment(coordinates)) { c...
java
{ "resource": "" }
q157483
ConvexHull.lineLineIntersect
train
public static Point2D lineLineIntersect(final Line2D lineA, final Line2D lineB) { return lineLineIntersect(lineA.getX1(), lineA.getY1(), lineA.getX2(), lineA.getY2(), lineB.getX1(), lineB.getY1(), lineB.getX2(), lineB.getY2()); }
java
{ "resource": "" }
q157484
ConvexHull.isLeftTurn
train
private static boolean isLeftTurn(Point2D a, Point2D b, Point2D c) { return winding(a, b, c) > 0; }
java
{ "resource": "" }
q157485
ConvexHull.winding
train
private static int winding(Point2D a, Point2D b, Point2D c) { return (int) Math.signum((b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY()) * (c.getX() - a.getX())); }
java
{ "resource": "" }
q157486
AbstractFontManager.getFontSizeForZoom
train
protected Integer getFontSizeForZoom(double zoom) { double lower = -1; for (double upper : this.zoomToFontSizeMap.keySet()) { if (lower == -1) { lower = upper; if (zoom <= lower) return this.zoomToFontSizeMap.get(upper); continue; }...
java
{ "resource": "" }
q157487
AbstractFontManager.increaseFontSize
train
public void increaseFontSize() { // move INTO range if we have just moved OUT of lower virtual if (inRange() || (atMin() && atLowerBoundary())) { currentFontIndex++; } else if (atMax()) { upperVirtualCount++; } else if (atMin() && inLower()) { lowerVir...
java
{ "resource": "" }
q157488
AbstractFontManager.decreaseFontSize
train
public void decreaseFontSize() { // move INTO range if we have just moved OUT of upper virtual if (inRange() || (atMax() && atUpperBoundary())) { currentFontIndex--; } else if (atMin()) { lowerVirtualCount--; } else if (atMax() && inUpper()) { upperVir...
java
{ "resource": "" }
q157489
VdWRadiusDescriptor.calculate
train
@Override public DescriptorValue calculate(IAtom atom, IAtomContainer container) { String symbol = atom.getSymbol(); double vdwradius = PeriodicTable.getVdwRadius(symbol); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(vd...
java
{ "resource": "" }
q157490
DynamicFactory.register
train
public <S extends ICDKObject, T extends S> boolean register(Class<S> intf, Constructor<T> constructor) { return register(intf, constructor, null); }
java
{ "resource": "" }
q157491
DynamicFactory.register
train
public <S extends ICDKObject, T extends S> boolean register(Class<S> intf, Constructor<T> constructor, CreationModifier<T> modifier) { // do not register private constructors if (Modifier.isPrivate(constructor.getModifiers()) || Modifier.isProtected(constructor.getModifiers())) ...
java
{ "resource": "" }
q157492
DynamicFactory.register
train
private <T> Creator<T> register(ConstructorKey key, Constructor<T> constructor, CreationModifier<T> modifier) { Creator<T> creator = new ReflectionCreator<T>(constructor); if (modifier != null) creator = new ModifiedCreator<T>(creator, modifier); return register(key, creator); }
java
{ "resource": "" }
q157493
DynamicFactory.ofClass
train
public <T extends ICDKObject> T ofClass(Class<T> intf, Object... objects) { try { if (!intf.isInterface()) throw new IllegalArgumentException("expected interface, got " + intf.getClass()); Creator<T> constructor = get(new ObjectBasedKey(intf, objects)); return constructor....
java
{ "resource": "" }
q157494
DynamicFactory.find
train
private <T> Creator<T> find(final ConstructorKey key) { for (ConstructorKey candidate : lookup.getCandidates(key)) { if (key.isAssignable(candidate)) { return get(candidate); } } // if the key has uniform parameter types if (key.isUniform()) { ...
java
{ "resource": "" }
q157495
DynamicFactory.implementorsOf
train
public <T extends ICDKObject> Set<Class<?>> implementorsOf(Class<T> intf) { Set<Class<?>> implementations = new HashSet<Class<?>>(5); for (ConstructorKey key : lookup.getConstructors(intf)) { implementations.add(get(key).getDeclaringClass()); } return implementations; }
java
{ "resource": "" }
q157496
SpanningTree.getSpanningTree
train
public IAtomContainer getSpanningTree() { IAtomContainer container = molecule.getBuilder().newInstance(IAtomContainer.class); for (int a = 0; a < totalVertexCount; a++) container.addAtom(molecule.getAtom(a)); for (int b = 0; b < totalEdgeCount; b++) if (bondsInTree[b]) co...
java
{ "resource": "" }
q157497
SpanningTree.getBasicRings
train
public IRingSet getBasicRings() throws NoSuchAtomException { IRingSet ringset = molecule.getBuilder().newInstance(IRingSet.class); IAtomContainer spt = getSpanningTree(); for (int i = 0; i < totalEdgeCount; i++) if (!bondsInTree[i]) ringset.addAtomContainer(getRing(spt, molecule.getB...
java
{ "resource": "" }
q157498
SpanningTree.getCyclicFragmentsContainer
train
public IAtomContainer getCyclicFragmentsContainer() { IAtomContainer fragContainer = this.molecule.getBuilder().newInstance(IAtomContainer.class); IAtomContainer spt = getSpanningTree(); for (int i = 0; i < totalEdgeCount; i++) if (!bondsInTree[i]) { IRing ring = get...
java
{ "resource": "" }
q157499
SpanningTree.identifyBonds
train
private void identifyBonds() { IAtomContainer spt = getSpanningTree(); IRing ring; int nBasicRings = 0; for (int i = 0; i < totalEdgeCount; i++) { if (!bondsInTree[i]) { ring = getRing(spt, molecule.getBond(i)); for (int b = 0; b < ring.getBond...
java
{ "resource": "" }