_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q156900 | AtomContainerManipulator.countExplicitHydrogens | train | public static int countExplicitHydrogens(IAtomContainer atomContainer, IAtom atom) {
if (atomContainer == null || atom == null)
throw new IllegalArgumentException("null container or atom provided");
int hCount = 0;
for (IAtom connected : atomContainer.getConnectedAtomsList(atom)) {
... | java | {
"resource": ""
} |
q156901 | AtomContainerManipulator.incrementImplHydrogenCount | train | private static void incrementImplHydrogenCount(final IAtom atom) {
Integer hCount = atom.getImplicitHydrogenCount();
if (hCount == null) {
if (!(atom instanceof IPseudoAtom))
throw new IllegalArgumentException("a non-pseudo atom had an unset hydrogen count");
hCo... | java | {
"resource": ""
} |
q156902 | AtomContainerManipulator.findSingleBond | train | private static IAtom findSingleBond(IAtomContainer container, IAtom atom, IAtom exclude) {
for (IBond bond : container.getConnectedBondsList(atom)) {
if (bond.getOrder() != Order.SINGLE)
continue;
IAtom neighbor = bond.getOther(atom);
if (!neighbor.equals(excl... | java | {
"resource": ""
} |
q156903 | AtomContainerManipulator.unregisterAtomListeners | train | public static void unregisterAtomListeners(IAtomContainer container) {
for (IAtom atom : container.atoms())
atom.removeListener(container);
} | java | {
"resource": ""
} |
q156904 | AtomContainerManipulator.getAtomArray | train | public static IAtom[] getAtomArray(IAtomContainer container) {
IAtom[] ret = new IAtom[container.getAtomCount()];
for (int i = 0; i < ret.length; ++i)
ret[i] = container.getAtom(i);
return ret;
} | java | {
"resource": ""
} |
q156905 | AtomContainerManipulator.clearAtomConfigurations | train | public static void clearAtomConfigurations(IAtomContainer container) {
for (IAtom atom : container.atoms()) {
atom.setAtomTypeName((String) CDKConstants.UNSET);
atom.setMaxBondOrder((IBond.Order) CDKConstants.UNSET);
atom.setBondOrderSum((Double) CDKConstants.UNSET);
... | java | {
"resource": ""
} |
q156906 | AtomContainerManipulator.createAllCarbonAllSingleNonAromaticBondAtomContainer | train | public static IAtomContainer createAllCarbonAllSingleNonAromaticBondAtomContainer(IAtomContainer atomContainer)
throws CloneNotSupportedException {
IAtomContainer query = (IAtomContainer) atomContainer.clone();
for (int i = 0; i < query.getBondCount(); i++) {
query.getBond(i).set... | java | {
"resource": ""
} |
q156907 | AtomContainerManipulator.anonymise | train | public static IAtomContainer anonymise(IAtomContainer src) {
IChemObjectBuilder builder = src.getBuilder();
IAtom[] atoms = new IAtom[src.getAtomCount()];
IBond[] bonds = new IBond[src.getBondCount()];
for (int i = 0; i < atoms.length; i++) {
atoms[i] = builder.newAtom();
... | java | {
"resource": ""
} |
q156908 | AtomContainerManipulator.getBondOrderSum | train | public static double getBondOrderSum(IAtomContainer container, IAtom atom) {
double count = 0;
for (IBond bond : container.getConnectedBondsList(atom)) {
IBond.Order order = bond.getOrder();
if (order != null) {
count += order.numeric();
}
}
... | java | {
"resource": ""
} |
q156909 | EssentialCycles.paths | train | public int[][] paths() {
final int[][] paths = new int[size()][];
for (int i = 0; i < paths.length; i++)
paths[i] = essential.get(i).path();
return paths;
} | java | {
"resource": ""
} |
q156910 | EssentialCycles.groupByLength | train | private List<List<Cycle>> groupByLength(final RelevantCycles relevant) {
LinkedList<List<Cycle>> cyclesByLength = new LinkedList<List<Cycle>>();
for (int[] path : relevant.paths()) {
if (cyclesByLength.isEmpty() || path.length > cyclesByLength.getLast().get(0).path().length) {
... | java | {
"resource": ""
} |
q156911 | EssentialCycles.membersOfBasis | train | private List<Cycle> membersOfBasis(final List<Cycle> cycles) {
int start = basis.size();
for (final Cycle c : cycles) {
if (basis.isIndependent(c)) basis.add(c);
}
return basis.members().subList(start, basis.size());
} | java | {
"resource": ""
} |
q156912 | QueryBond.compare | train | @Override
public boolean compare(Object object) {
if (object instanceof IQueryBond) {
QueryBond queryBond = (QueryBond) object;
for (IAtom atom : atoms) {
if (!queryBond.contains(atom)) {
return false;
}
}
re... | java | {
"resource": ""
} |
q156913 | DisjointSetForest.makeUnion | train | public void makeUnion(int elementX, int elementY) {
int xRoot = getRoot(elementX);
int yRoot = getRoot(elementY);
if (xRoot == yRoot) {
return;
}
if (forest[xRoot] < forest[yRoot]) {
forest[yRoot] = forest[yRoot] + forest[xRoot];
forest[xRoot... | java | {
"resource": ""
} |
q156914 | DisjointSetForest.getSets | train | public int[][] getSets() {
int n = 0;
for (int i = 0; i < forest.length; i++) {
if (forest[i] < 0) {
n++;
}
}
int[][] sets = new int[n][];
int currentSet = 0;
for (int i = 0; i < forest.length; i++) {
if (forest[i] < 0) ... | java | {
"resource": ""
} |
q156915 | BioPolymer.addAtom | train | @Override
public void addAtom(IAtom oAtom, IStrand oStrand) {
int atomCount = super.getAtomCount();
// Add atom to AtomContainer
super.addAtom(oAtom);
if (atomCount != super.getAtomCount() && oStrand != null) { // Maybe better to throw null pointer exception here, so user realises... | java | {
"resource": ""
} |
q156916 | BioPolymer.getMonomerCount | train | @Override
public int getMonomerCount() {
Iterator<String> keys = strands.keySet().iterator();
int number = 0;
if (!keys.hasNext()) // no strands
return super.getMonomerCount();
while (keys.hasNext()) {
Strand tmp = (Strand) strands.get(keys.next()); // Cast ... | java | {
"resource": ""
} |
q156917 | BioPolymer.removeStrand | train | @Override
public void removeStrand(String name) {
if (strands.containsKey(name)) {
Strand strand = (Strand) strands.get(name);
this.remove(strand);
strands.remove(name);
}
} | java | {
"resource": ""
} |
q156918 | StandardGenerator.embedText | train | public static IRenderingElement embedText(Font font, String text, Color color, double scale) {
final String[] lines = text.split("\n");
ElementGroup group = new ElementGroup();
double yOffset = 0;
double lineHeight = 1.4d;
for (String line : lines) {
TextOutline o... | java | {
"resource": ""
} |
q156919 | StandardGenerator.getColorProperty | train | static Color getColorProperty(IChemObject object, String key) {
Object value = object.getProperty(key);
if (value instanceof Color) return (Color) value;
if (value != null) throw new IllegalArgumentException(key + " property should be a java.awt.Color");
return null;
} | java | {
"resource": ""
} |
q156920 | StandardGenerator.recolor | train | private static IRenderingElement recolor(IRenderingElement element, Color color) {
if (element instanceof ElementGroup) {
ElementGroup orgGroup = (ElementGroup) element;
ElementGroup newGroup = new ElementGroup();
for (IRenderingElement child : orgGroup) {
new... | java | {
"resource": ""
} |
q156921 | StandardGenerator.outerGlow | train | static IRenderingElement outerGlow(IRenderingElement element, Color color, double glowWidth, double stroke) {
if (element instanceof ElementGroup) {
ElementGroup orgGroup = (ElementGroup) element;
ElementGroup newGroup = new ElementGroup();
for (IRenderingElement child : orgG... | java | {
"resource": ""
} |
q156922 | StandardGenerator.isPlainBond | train | static boolean isPlainBond(IBond bond) {
return bond.getOrder() == IBond.Order.SINGLE
&& (bond.getStereo() == IBond.Stereo.NONE || bond.getStereo() == null);
} | java | {
"resource": ""
} |
q156923 | StandardGenerator.isWedged | train | static boolean isWedged(IBond bond) {
return (bond.getStereo() == IBond.Stereo.UP || bond.getStereo() == IBond.Stereo.DOWN
|| bond.getStereo() == IBond.Stereo.UP_INVERTED || bond.getStereo() == IBond.Stereo.DOWN_INVERTED);
} | java | {
"resource": ""
} |
q156924 | StandardGenerator.unhide | train | static void unhide(IChemObject chemobj) {
chemobj.setProperty(HIDDEN, false);
chemobj.setProperty(HIDDEN_FULLY, false);
} | java | {
"resource": ""
} |
q156925 | Tanimoto.method1 | train | public static double method1(ICountFingerprint fp1, ICountFingerprint fp2) {
long xy = 0, x = 0, y = 0;
for (int i = 0; i < fp1.numOfPopulatedbins(); i++) {
int hash = fp1.getHash(i);
for (int j = 0; j < fp2.numOfPopulatedbins(); j++) {
if (hash == fp2.getHash(j))... | java | {
"resource": ""
} |
q156926 | LingoSimilarity.calculate | train | public static float calculate(Map<String, Integer> features1, Map<String, Integer> features2) {
TreeSet<String> keys = new TreeSet<String>(features1.keySet());
keys.addAll(features2.keySet());
float sum = 0.0f;
for (String key : keys) {
Integer c1 = features1.get(key);
... | java | {
"resource": ""
} |
q156927 | ToleranceRangeRule.setParameters | train | @Override
public void setParameters(Object[] params) throws CDKException {
if (params.length > 2) throw new CDKException("ToleranceRangeRule expects only two parameter");
if (!(params[0] instanceof Double)) throw new CDKException("The parameter 0 must be of type Double");
if (!(params[1] i... | java | {
"resource": ""
} |
q156928 | ToleranceRangeRule.getParameters | train | @Override
public Object[] getParameters() {
// return the parameters as used for the rule validation
Object[] params = new Object[2];
params[0] = mass;
params[1] = tolerance;
return params;
} | java | {
"resource": ""
} |
q156929 | ToleranceRangeRule.validate | train | @Override
public double validate(IMolecularFormula formula) throws CDKException {
logger.info("Start validation of ", formula);
double totalExactMass = MolecularFormulaManipulator.getTotalExactMass(formula);
if (Math.abs(totalExactMass - mass) > tolerance)
return 0.0;
e... | java | {
"resource": ""
} |
q156930 | RGraph.addNode | train | public void addNode(RNode newNode) {
graph.add(newNode);
graphBitSet.set(graph.size() - 1);
} | java | {
"resource": ""
} |
q156931 | RGraph.parseRec | train | private void parseRec(BitSet traversed, BitSet extension, BitSet forbidden) {
BitSet newTraversed = null;
BitSet newExtension = null;
BitSet newForbidden = null;
BitSet potentialNode = null;
// Test whether the timeout is reached. Stop searching.
if (this.timeout > -1 &&... | java | {
"resource": ""
} |
q156932 | RGraph.buildB | train | private BitSet buildB(BitSet c1, BitSet c2) {
this.c1 = c1;
this.c2 = c2;
BitSet bs = new BitSet();
// only nodes that fulfill the initial constrains
// are allowed in the initial extension set : B
for (Iterator<RNode> i = graph.iterator(); i.hasNext();) {
R... | java | {
"resource": ""
} |
q156933 | RGraph.projectG1 | train | public BitSet projectG1(BitSet set) {
BitSet projection = new BitSet(firstGraphSize);
RNode xNode = null;
for (int x = set.nextSetBit(0); x >= 0; x = set.nextSetBit(x + 1)) {
xNode = (RNode) graph.get(x);
projection.set(xNode.rMap.id1);
}
return projectio... | java | {
"resource": ""
} |
q156934 | RGraph.projectG2 | train | public BitSet projectG2(BitSet set) {
BitSet projection = new BitSet(secondGraphSize);
RNode xNode = null;
for (int x = set.nextSetBit(0); x >= 0; x = set.nextSetBit(x + 1)) {
xNode = (RNode) graph.get(x);
projection.set(xNode.rMap.id2);
}
return projecti... | java | {
"resource": ""
} |
q156935 | RGraph.isContainedIn | train | private boolean isContainedIn(BitSet A, BitSet B) {
boolean result = false;
if (A.isEmpty()) {
return true;
}
BitSet setA = (BitSet) A.clone();
setA.and(B);
if (setA.equals(A)) {
result = true;
}
return result;
} | java | {
"resource": ""
} |
q156936 | AtomTypeModel.electronsForAtomType | train | private static int electronsForAtomType(IAtom atom) {
Integer electrons = TYPES.get(atom.getAtomTypeName());
if (electrons != null) return electrons;
try {
IAtomType atomType = AtomTypeFactory.getInstance("org/openscience/cdk/dict/data/cdk-atom-types.owl",
atom.... | java | {
"resource": ""
} |
q156937 | FingerprinterTool.makeBitFingerprint | train | public static IBitFingerprint makeBitFingerprint(final Map<String,Integer> features, int len) {
return makeBitFingerprint(features, len, 1);
} | java | {
"resource": ""
} |
q156938 | VFState.matchAtoms | train | private boolean matchAtoms(Match match) {
IAtom atom = match.getTargetAtom();
if (match.getQueryNode().countNeighbors() > target.countNeighbors(atom)) {
return false;
}
return match.getQueryNode().getAtomMatcher().matches(target, atom);
} | java | {
"resource": ""
} |
q156939 | TopologicalMatrix.getMatrix | train | public static int[][] getMatrix(IAtomContainer container) {
int[][] conMat = AdjacencyMatrix.getMatrix(container);
int[][] topolDistance = PathTools.computeFloydAPSP(conMat);
return topolDistance;
} | java | {
"resource": ""
} |
q156940 | HydrogenPlacer.placeHydrogens2D | train | public void placeHydrogens2D(final IAtomContainer container, final double bondLength) {
logger.debug("placing hydrogens on all atoms");
for (IAtom atom : container.atoms()) {
// only place hydrogens for atoms which have coordinates
if (atom.getPoint2d() != null) {
... | java | {
"resource": ""
} |
q156941 | HydrogenPlacer.placeHydrogens2D | train | public void placeHydrogens2D(IAtomContainer container, IAtom atom) {
double bondLength = GeometryUtil.getBondLengthAverage(container);
placeHydrogens2D(container, atom, bondLength);
} | java | {
"resource": ""
} |
q156942 | SilentChemObjectBuilder.getSystemProp | train | private static boolean getSystemProp(final String key, final boolean defaultValue) {
String val = System.getProperty(key);
if (val == null)
val = System.getenv(key);
if (val == null) {
return defaultValue;
} else if (val.isEmpty()) {
return true;
... | java | {
"resource": ""
} |
q156943 | SwissArmyKnife.getDuration | train | public static String getDuration(long diff) {
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(new Date(diff));
StringBuffer s = new StringBuffer();
if (calendar.get(Calendar.HOUR) > 1) {
s.append("hours: " + (calendar.get(Calendar.HOUR) - 1) + ", ");
... | java | {
"resource": ""
} |
q156944 | SwissArmyKnife.printInt2D | train | public static String printInt2D(int[][] contab) {
String line = "";
for (int f = 0; f < contab.length; f++) {
for (int g = 0; g < contab.length; g++) {
line += contab[f][g] + " ";
}
line += "\n";
}
return line;
} | java | {
"resource": ""
} |
q156945 | VecmathUtil.newUnitVector | train | static Vector2d newUnitVector(final Tuple2d from, final Tuple2d to) {
final Vector2d vector = new Vector2d(to.x - from.x, to.y - from.y);
vector.normalize();
return vector;
} | java | {
"resource": ""
} |
q156946 | VecmathUtil.newUnitVector | train | static Vector2d newUnitVector(final IAtom atom, final IBond bond) {
return newUnitVector(atom.getPoint2d(), bond.getOther(atom).getPoint2d());
} | java | {
"resource": ""
} |
q156947 | VecmathUtil.newUnitVectors | train | static List<Vector2d> newUnitVectors(final IAtom fromAtom, final List<IAtom> toAtoms) {
final List<Vector2d> unitVectors = new ArrayList<Vector2d>(toAtoms.size());
for (final IAtom toAtom : toAtoms) {
unitVectors.add(newUnitVector(fromAtom.getPoint2d(), toAtom.getPoint2d()));
}
... | java | {
"resource": ""
} |
q156948 | VecmathUtil.midpoint | train | static Point2d midpoint(Point2d a, Point2d b) {
return new Point2d((a.x + b.x) / 2, (a.y + b.y) / 2);
} | java | {
"resource": ""
} |
q156949 | VecmathUtil.scale | train | static Vector2d scale(final Tuple2d vector, final double factor) {
final Vector2d cpy = new Vector2d(vector);
cpy.scale(factor);
return cpy;
} | java | {
"resource": ""
} |
q156950 | VecmathUtil.sum | train | static Vector2d sum(final Tuple2d a, final Tuple2d b) {
return new Vector2d(a.x + b.x, a.y + b.y);
} | java | {
"resource": ""
} |
q156951 | VecmathUtil.intersection | train | static Point2d intersection(final Tuple2d p1, final Tuple2d d1, final Tuple2d p2, final Tuple2d d2) {
final Vector2d p1End = sum(p1, d1);
final Vector2d p2End = sum(p2, d2);
return intersection(p1.x, p1.y, p1End.x, p1End.y, p2.x, p2.y, p2End.x, p2End.y);
} | java | {
"resource": ""
} |
q156952 | VecmathUtil.adjacentLength | train | static double adjacentLength(Vector2d hypotenuse, Vector2d adjacent, double oppositeLength) {
return Math.tan(hypotenuse.angle(adjacent)) * oppositeLength;
} | java | {
"resource": ""
} |
q156953 | VecmathUtil.average | train | static Vector2d average(final Collection<Vector2d> vectors) {
final Vector2d average = new Vector2d(0, 0);
for (final Vector2d vector : vectors) {
average.add(vector);
}
average.scale(1d / vectors.size());
return average;
} | java | {
"resource": ""
} |
q156954 | VecmathUtil.getNearestVector | train | static Vector2d getNearestVector(final Vector2d reference, final List<Vector2d> vectors) {
if (vectors.isEmpty()) throw new IllegalArgumentException("No vectors provided");
// to find the closest vector we find use the dot product,
// for the general case (non-unit vectors) one can use the
... | java | {
"resource": ""
} |
q156955 | VecmathUtil.getNearestVector | train | static Vector2d getNearestVector(Vector2d reference, IAtom fromAtom, List<IBond> bonds) {
final List<IAtom> toAtoms = new ArrayList<IAtom>();
for (IBond bond : bonds) {
toAtoms.add(bond.getOther(fromAtom));
}
return getNearestVector(reference, newUnitVectors(fromAtom, toAto... | java | {
"resource": ""
} |
q156956 | VecmathUtil.extents | train | static double[] extents(final List<Vector2d> vectors) {
final int n = vectors.size();
final double[] extents = new double[n];
for (int i = 0; i < n; i++)
extents[i] = VecmathUtil.extent(vectors.get(i));
return extents;
} | java | {
"resource": ""
} |
q156957 | AtomType.compare | train | @Override
public boolean compare(Object object) {
if (!(object instanceof IAtomType)) {
return false;
}
if (!super.compare(object)) {
return false;
}
AtomType type = (AtomType) object;
return Objects.equal(getAtomTypeName(), type.getAtomTypeNam... | java | {
"resource": ""
} |
q156958 | MolecularFormula.add | train | @Override
public IMolecularFormula add(IMolecularFormula formula) {
for (IIsotope newIsotope : formula.isotopes()) {
addIsotope(newIsotope, formula.getIsotopeCount(newIsotope));
}
if (formula.getCharge() != null) {
if (charge != null)
charge += formula... | java | {
"resource": ""
} |
q156959 | GreedyBasis.add | train | final void add(final Cycle cycle) {
basis.add(cycle);
edgesOfBasis.or(cycle.edgeVector());
} | java | {
"resource": ""
} |
q156960 | MorganNumbersTools.getMorganNumbers | train | public static long[] getMorganNumbers(IAtomContainer molecule) {
int order = molecule.getAtomCount();
long[] currentInvariants = new long[order];
long[] previousInvariants = new long[order];
int[][] graph = new int[order][INITIAL_DEGREE];
int[] degree = new int[order];
... | java | {
"resource": ""
} |
q156961 | Isomorphism.makeBondMapsOfAtomMaps | train | public static List<Map<IBond, IBond>> makeBondMapsOfAtomMaps(IAtomContainer ac1, IAtomContainer ac2,
List<Map<IAtom, IAtom>> mappings) {
List<Map<IBond, IBond>> bondMaps = new ArrayList<Map<IBond, IBond>>();
for (Map<IAtom, IAtom> mapping : mappings) {
bondMaps.add(makeBondMapOfA... | java | {
"resource": ""
} |
q156962 | Isomorphism.init | train | public void init(String sourceMolFileName, String targetMolFileName, boolean removeHydrogen,
boolean cleanAndConfigureMolecule) throws CDKException {
this.removeHydrogen = removeHydrogen;
init(new MolHandler(sourceMolFileName, cleanAndConfigureMolecule, removeHydrogen), new MolHandler(
... | java | {
"resource": ""
} |
q156963 | SMARTSAtom.invariants | train | final SMARTSAtomInvariants invariants(final IAtom atom) {
final SMARTSAtomInvariants inv = atom.getProperty(SMARTSAtomInvariants.KEY);
if (inv == null)
throw new NullPointerException(
"Missing SMARTSAtomInvariants - please compute these values before matching.");
... | java | {
"resource": ""
} |
q156964 | CrystClustWriter.write | train | @Override
public void write(IChemObject object) throws UnsupportedChemObjectException {
if (object instanceof ICrystal) {
writeCrystal((ICrystal) object);
} else if (object instanceof IChemSequence) {
writeChemSequence((IChemSequence) object);
} else {
thr... | java | {
"resource": ""
} |
q156965 | CrystClustWriter.writeCrystal | train | private void writeCrystal(ICrystal crystal) {
String sg = crystal.getSpaceGroup();
if ("P 2_1 2_1 2_1".equals(sg)) {
writeln("P 21 21 21 (1)");
} else {
writeln("P 1 (1)");
}
// output unit cell axes
writeVector3d(crystal.getA());
writeVe... | java | {
"resource": ""
} |
q156966 | GeneralPath.recolor | train | public GeneralPath recolor(Color newColor) {
return new GeneralPath(elements, newColor, winding, stroke, fill);
} | java | {
"resource": ""
} |
q156967 | GeneralPath.shapeOf | train | public static GeneralPath shapeOf(Shape shape, Color color) {
List<PathElement> elements = new ArrayList<PathElement>();
PathIterator pathIt = shape.getPathIterator(new AffineTransform());
double[] data = new double[6];
while (!pathIt.isDone()) {
switch (pathIt.currentSegment... | java | {
"resource": ""
} |
q156968 | PerturbedAtomHashGenerator.combine | train | long[] combine(long[][] perturbed) {
int n = perturbed.length;
int m = perturbed[0].length;
long[] combined = new long[n];
long[] rotated = new long[m];
for (int i = 0; i < n; i++) {
Arrays.sort(perturbed[i]);
for (int j = 0; j < m; j++) {
... | java | {
"resource": ""
} |
q156969 | BasicBondGenerator.getRingSet | train | protected IRingSet getRingSet(IAtomContainer atomContainer) {
IRingSet ringSet = atomContainer.getBuilder().newInstance(IRingSet.class);
try {
IAtomContainerSet molecules = ConnectivityChecker.partitionIntoMolecules(atomContainer);
for (IAtomContainer mol : molecules.atomContain... | java | {
"resource": ""
} |
q156970 | BasicBondGenerator.getColorForBond | train | public Color getColorForBond(IBond bond, RendererModel model) {
if (this.overrideColor != null) {
return overrideColor;
}
Color color = model.getParameter(ColorHash.class).getValue().get(bond);
if (color == null) {
return model.getParameter(DefaultBondColor.class... | java | {
"resource": ""
} |
q156971 | BasicBondGenerator.getWidthForBond | train | public double getWidthForBond(IBond bond, RendererModel model) {
double scale = model.getParameter(Scale.class).getValue();
if (this.overrideBondWidth != -1) {
return this.overrideBondWidth / scale;
} else {
return model.getParameter(BondWidth.class).getValue() / scale;
... | java | {
"resource": ""
} |
q156972 | BasicBondGenerator.generateBondElement | train | public IRenderingElement generateBondElement(IBond bond, IBond.Order type, RendererModel model) {
// More than 2 atoms per bond not supported by this module
if (bond.getAtomCount() > 2) return null;
// is object right? if not replace with a good one
Point2d point1 = bond.getBegin().getP... | java | {
"resource": ""
} |
q156973 | BasicBondGenerator.generateRingElements | train | public IRenderingElement generateRingElements(IBond bond, IRing ring, RendererModel model) {
if (isSingle(bond) && isStereoBond(bond)) {
return generateStereoElement(bond, model);
} else if (isDouble(bond)) {
ElementGroup pair = new ElementGroup();
pair.add(generateBo... | java | {
"resource": ""
} |
q156974 | BasicBondGenerator.generateInnerElement | train | public LineElement generateInnerElement(IBond bond, IRing ring, RendererModel model) {
Point2d center = GeometryUtil.get2DCenter(ring);
Point2d a = bond.getBegin().getPoint2d();
Point2d b = bond.getEnd().getPoint2d();
// the proportion to move in towards the ring center
double d... | java | {
"resource": ""
} |
q156975 | BasicBondGenerator.isStereoBond | train | private boolean isStereoBond(IBond bond) {
return bond.getStereo() != IBond.Stereo.NONE && bond.getStereo() != (IBond.Stereo) CDKConstants.UNSET
&& bond.getStereo() != IBond.Stereo.E_Z_BY_COORDINATES;
} | java | {
"resource": ""
} |
q156976 | BasicBondGenerator.bindsHydrogen | train | protected boolean bindsHydrogen(IBond bond) {
for (int i = 0; i < bond.getAtomCount(); i++) {
IAtom atom = bond.getAtom(i);
if ("H".equals(atom.getSymbol())) return true;
}
return false;
} | java | {
"resource": ""
} |
q156977 | BasicBondGenerator.generateBond | train | public IRenderingElement generateBond(IBond bond, RendererModel model) {
boolean showExplicitHydrogens = true;
if (model.hasParameter(BasicAtomGenerator.ShowExplicitHydrogens.class)) {
showExplicitHydrogens = model.getParameter(BasicAtomGenerator.ShowExplicitHydrogens.class).getValue();
... | java | {
"resource": ""
} |
q156978 | MolecularFormulaSetManipulator.getMaxOccurrenceElements | train | public static IMolecularFormula getMaxOccurrenceElements(IMolecularFormulaSet mfSet) {
IMolecularFormula molecularFormula = mfSet.getBuilder().newInstance(IMolecularFormula.class);
for (IMolecularFormula mf : mfSet.molecularFormulas()) {
for (IIsotope isotope : mf.isotopes()) {
... | java | {
"resource": ""
} |
q156979 | MolecularFormulaSetManipulator.validCorrelation | train | private static boolean validCorrelation(IMolecularFormula formulaMin, IMolecularFormula formulamax) {
for (IElement element : MolecularFormulaManipulator.elements(formulaMin)) {
if (!MolecularFormulaManipulator.containsElement(formulamax, element)) return false;
}
return true;
} | java | {
"resource": ""
} |
q156980 | MolecularFormulaSetManipulator.contains | train | public static boolean contains(IMolecularFormulaSet formulaSet, IMolecularFormula formula) {
for (IMolecularFormula fm : formulaSet.molecularFormulas()) {
if (MolecularFormulaManipulator.compare(fm, formula)) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q156981 | OneElectronJob.sort | train | private void sort(Matrix C, Vector E) {
int i, j;
double value;
boolean changed;
do {
changed = false;
for (i = 1; i < E.size; i++)
if (E.vector[i - 1] > E.vector[i]) {
value = E.vector[i];
E.vector[i] = E.ve... | java | {
"resource": ""
} |
q156982 | OneElectronJob.calculateT | train | private Matrix calculateT(IBasis basis) {
int size = basis.getSize();
Matrix J = new Matrix(size, size);
int i, j;
for (i = 0; i < size; i++)
for (j = 0; j < size; j++)
// (1/2) * -<d^2/dx^2 chi_i | chi_j>
J.matrix[i][j] = basis.calcJ(j, i) / 2... | java | {
"resource": ""
} |
q156983 | OneElectronJob.calculateV | train | private Matrix calculateV(IBasis basis) {
int size = basis.getSize();
Matrix V = new Matrix(size, size);
int i, j;
for (i = 0; i < size; i++)
for (j = 0; j < size; j++)
V.matrix[i][j] = basis.calcV(i, j);
return V;
} | java | {
"resource": ""
} |
q156984 | ChemFile.addChemSequence | train | @Override
public void addChemSequence(IChemSequence chemSequence) {
if (chemSequenceCount + 1 >= chemSequences.length) {
growChemSequenceArray();
}
chemSequences[chemSequenceCount] = chemSequence;
chemSequenceCount++;
} | java | {
"resource": ""
} |
q156985 | AtomContainerAtomPermutor.containerFromPermutation | train | @Override
public IAtomContainer containerFromPermutation(int[] permutation) {
try {
IAtomContainer permutedContainer = (IAtomContainer) atomContainer.clone();
IAtom[] atoms = new IAtom[atomContainer.getAtomCount()];
for (int i = 0; i < atomContainer.getAtomCount(); i++) {... | java | {
"resource": ""
} |
q156986 | MDLV3000Reader.readSGroup | train | public void readSGroup(IAtomContainer readData) throws CDKException {
boolean foundEND = false;
while (isReady() && !foundEND) {
String command = readCommand(readLine());
if ("END SGROUP".equals(command)) {
foundEND = true;
} else {
log... | java | {
"resource": ""
} |
q156987 | MDLV3000Reader.readCommand | train | private String readCommand(String line) throws CDKException {
if (line.startsWith("M V30 ")) {
String command = line.substring(7);
if (command.endsWith("-")) {
command = command.substring(0, command.length() - 1);
command += readCommand(readLine());
... | java | {
"resource": ""
} |
q156988 | EquivalentClassPartitioner.getTopoEquivClassbyHuXu | train | public int[] getTopoEquivClassbyHuXu(IAtomContainer atomContainer) throws NoSuchAtomException {
double nodeSequence[] = prepareNode(atomContainer);
nodeMatrix = buildNodeMatrix(nodeSequence);
bondMatrix = buildBondMatrix();
weight = buildWeightMatrix(nodeMatrix, bondMatrix);
retu... | java | {
"resource": ""
} |
q156989 | EquivalentClassPartitioner.buildNodeMatrix | train | public double[][] buildNodeMatrix(double[] nodeSequence) {
int i, j, k;
for (i = 0; i < nodeNumber; i++) {
nodeMatrix[i][0] = nodeSequence[i];
for (j = 1; j <= layerNumber; j++) {
nodeMatrix[i][j] = 0.0;
for (k = 0; k < nodeNumber; k++) {
... | java | {
"resource": ""
} |
q156990 | EquivalentClassPartitioner.buildTrialNodeMatrix | train | public double[][] buildTrialNodeMatrix(double[] weight) {
int i, j, k;
for (i = 0; i < nodeNumber; i++) {
nodeMatrix[i][0] = weight[i + 1];
for (j = 1; j <= layerNumber; j++) {
nodeMatrix[i][j] = 0.0;
for (k = 0; k < nodeNumber; k++) {
... | java | {
"resource": ""
} |
q156991 | EquivalentClassPartitioner.buildBondMatrix | train | public double[][] buildBondMatrix() {
int i, j, k, m;
for (i = 0; i < nodeNumber; i++) {
for (j = 1; j <= layerNumber; j++) {
bondMatrix[i][j - 1] = 0.0;
for (k = 0; k < nodeNumber; k++) {
if (j == 1) {
if (apspMatri... | java | {
"resource": ""
} |
q156992 | EquivalentClassPartitioner.buildWeightMatrix | train | public double[] buildWeightMatrix(double[][] nodeMatrix, double[][] bondMatrix) {
for (int i = 0; i < nodeNumber; i++) {
weight[i + 1] = nodeMatrix[i][0];
for (int j = 0; j < layerNumber; j++) {
weight[i + 1] += nodeMatrix[i][j + 1] * bondMatrix[i][j] * Math.pow(10.0, (do... | java | {
"resource": ""
} |
q156993 | EquivalentClassPartitioner.checkDiffNumber | train | public int checkDiffNumber(double[] weight) {
// Count the number of different weight
double category[] = new double[weight.length];
int i, j;
int count = 1;
double t;
category[1] = weight[1];
for (i = 2; i < weight.length; i++) {
for (j = 1; j <= coun... | java | {
"resource": ""
} |
q156994 | EquivalentClassPartitioner.getEquivalentClass | train | public int[] getEquivalentClass(double[] weight) {
double category[] = new double[weight.length];
int equivalentClass[] = new int[weight.length];
int i, j;
int count = 1;
double t;
category[1] = weight[1];
for (i = 2; i < weight.length; i++) {
for (j =... | java | {
"resource": ""
} |
q156995 | EquivalentClassPartitioner.findTopoEquivClass | train | public int[] findTopoEquivClass(double[] weight) {
int trialCount, i;
int equivalentClass[] = new int[weight.length];
int count = checkDiffNumber(weight);
trialCount = count;
if (count == nodeNumber) {
for (i = 1; i <= nodeNumber; i++) {
equivalentClas... | java | {
"resource": ""
} |
q156996 | SmartsMatchers.prepare | train | public static void prepare(IAtomContainer container, boolean ringQuery) {
if (ringQuery) {
SMARTSAtomInvariants.configureDaylightWithRingInfo(container);
} else {
SMARTSAtomInvariants.configureDaylightWithoutRingInfo(container);
}
} | java | {
"resource": ""
} |
q156997 | BasicValidator.validateCharge | train | private ValidationReport validateCharge(IAtom atom) {
ValidationReport report = new ValidationReport();
ValidationTest tooCharged = new ValidationTest(atom, "Atom has an unlikely large positive or negative charge");
if (atom.getSymbol().equals("O") || atom.getSymbol().equals("N") || atom.getSymb... | java | {
"resource": ""
} |
q156998 | BasicValidator.validateStereoChemistry | train | private ValidationReport validateStereoChemistry(IBond bond) {
ValidationReport report = new ValidationReport();
ValidationTest bondStereo = new ValidationTest(bond, "Defining stereochemistry on bonds is not safe.",
"Use atom based stereochemistry.");
if (bond.getStereo() != IBon... | java | {
"resource": ""
} |
q156999 | BasicValidator.validateIsotopeExistence | train | public ValidationReport validateIsotopeExistence(IIsotope isotope) {
ValidationReport report = new ValidationReport();
ValidationTest isotopeExists = new ValidationTest(isotope,
"Isotope with this mass number is not known for this element.");
try {
IsotopeFactory isot... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.