Skip to content

Commit

Permalink
Followed Brian's recommendation and reduced number of hashed sequences
Browse files Browse the repository at this point in the history
by two by excluding reverse pathes.


git-svn-id: https://cdk.svn.sourceforge.net/svnroot/cdk/trunk/cdk@368 eb4e18e3-b210-0410-a6ab-dec725e4b171
  • Loading branch information
steinbeck committed Feb 25, 2002
1 parent 1309364 commit ad524ca
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 12 deletions.
55 changes: 48 additions & 7 deletions build.xml
@@ -1,6 +1,7 @@
<project name="CDK" default="compile" basedir=".">

<property name="build.compiler" value="modern" />
<property name="build.compiler" value="javac1.1" />
<property name="build.target" value="1.1" />
<property name="build" value="build" />
<property name="sourcedist" value="sourcedist" />
<property name="dist" value="dist" />
Expand All @@ -17,11 +18,9 @@
location="/usr/lib/j2sdk1.3/jre/lib/rt.jar" />

<pathelement location="." />

<fileset dir="jar">
<include name="*.jar" />
</fileset>

<fileset dir="${pathtojava3d}">
<include name="*.jar" />
</fileset>
Expand Down Expand Up @@ -49,9 +48,51 @@
<delete dir="${reports.tests}" />
</target>

<target name="compile" depends="init">


<target name="compile118" depends="init">
<echo message="Compiling only the classes that are needed
for use in a drawing applet and don't use Java3d." />
<echo
message="Compiling only the classes that don't use Java3d." />
message="Use 'compile-with-java3d' target for full Java3D support. " />
<mkdir dir="${build}" />

<javac destdir="${build}" optimize="on" debug="off" deprecation="off">
<src path="." />
<exclude name="${sourcedist}/**" />
<exclude name="org/openscience/cdk/test/**"/>
<exclude name="org/openscience/cdk/database/**"/>
<exclude name="org/openscience/cdk/renderer/Molecule*.*"/>
<exclude name="org/openscience/cdk/renderer/GraphRend*.*"/>
<exclude name="org/openscience/cdk/renderer/AtomicTable*.*"/>
<exclude name="org/openscience/cdk/io/CMLReader*.*"/>

<exclude
name="org/openscience/cdk/applications/Viewer.java" />
<exclude
name="org/openscience/cdk/renderer/AcceleratedRenderer3D*" />
<exclude
name="org/openscience/cdk/renderer/OrbitalsRenderer3D*" />
<exclude
name="org/openscience/cdk/test/AcceleratedRenderer3DTest.java" />
<exclude
name="org/openscience/cdk/test/OrbitalsRenderer3DTest.java" />
<exclude
name="org/openscience/cdk/test/VisualGaussiansCalculationTest.java" />
<exclude
name="org/openscience/cdk/test/ZMatrixReaderTest.java" />

<classpath refid="project.class.path" />
</javac>

<copy todir="${build}">
<fileset dir="." includes="**/Test-*" />
</copy>
</target>


<target name="compile" depends="init">
<echo message="Compiling only the classes that don't use Java3d." />

<echo
message="Use 'compile-with-java3d' target for full Java3D support. " />
Expand All @@ -60,7 +101,6 @@

<javac destdir="${build}" optimize="off" debug="on" deprecation="off">
<src path="." />

<exclude name="${sourcedist}/**" />
<exclude
name="org/openscience/cdk/applications/Viewer.java" />
Expand Down Expand Up @@ -251,7 +291,7 @@
</target>

<target name="run" depends="dist">
<java classname="org.openscience.cdk.test.Renderer2DTest" fork="yes">
<java classname="org.openscience.cdk.test.FingerprinterTest" fork="yes">
<classpath>
<pathelement
location="${dist}/jar/cdk.jar" />
Expand Down Expand Up @@ -280,3 +320,4 @@
</project>



15 changes: 12 additions & 3 deletions org/openscience/cdk/fingerprint/Fingerprinter.java
Expand Up @@ -50,7 +50,8 @@ public class Fingerprinter implements CDKConstants
static int defaultSize = 1024;
static int searchDepth = 7;
static Hashtable pathes;

static boolean debug = true;
static int debugCounter = 0;

/**
* Generates a fingerprint of the default size for the given AtomContainer
Expand Down Expand Up @@ -96,6 +97,7 @@ public static BitSet getFingerprint(AtomContainer ac, int size)
static void findPathes(AtomContainer ac)
{
pathes = new Hashtable();
debugCounter = 0;
for (int f = 0; f < ac.getAtomCount(); f++)
{
for (int g = 0; g < ac.getAtomCount(); g++)
Expand All @@ -122,16 +124,23 @@ static void depthFirstSearch(AtomContainer ac, Atom root, String currentPath, in
root.flags[VISITED] = true;
currentDepth++;
String newPath = new String(currentPath);
String reversePath = null;
StringBuffer strBuff = null;
for (int f = 0; f < bonds.length; f++)
{
nextAtom = bonds[f].getConnectedAtom(root);
if (!nextAtom.flags[VISITED])
{
newPath += nextAtom.getSymbol();
if (!pathes.containsKey(newPath))
reversePath = new StringBuffer(newPath).reverse().toString();
if (!pathes.containsKey(newPath) && !pathes.containsKey(reversePath))
{
pathes.put(newPath, newPath);
System.out.println(newPath + ", Hash: " + newPath.hashCode());
if (debug)
{
debugCounter ++;
System.out.println("Path no. " + debugCounter + ": " + newPath + ", Hash: " + newPath.hashCode());
}
}
if (currentDepth == searchDepth)
{
Expand Down
2 changes: 1 addition & 1 deletion org/openscience/cdk/io/cml/cdopi/CDOAcceptedObjects.java
Expand Up @@ -35,7 +35,7 @@ public CDOAcceptedObjects () {
}

public void add(String object) {
objects.add(object);
objects.addElement(object);
}

public boolean contains(String object) {
Expand Down
2 changes: 2 additions & 0 deletions org/openscience/cdk/test/FingerprinterTest.java
Expand Up @@ -42,7 +42,9 @@ public static boolean test()
{
Molecule mol = MoleculeFactory.makeAlphaPinene();
BitSet bs = Fingerprinter.getFingerprint(mol);
System.out.println("Resulting BitSet looks like:");
System.out.println(bs);
System.out.println("(Numbers indicate position of '1' Bits)");
return false;
}

Expand Down
3 changes: 2 additions & 1 deletion org/openscience/cdk/tools/LoggingTool.java
Expand Up @@ -43,7 +43,8 @@ public LoggingTool(String classname) {
// configure Log4J
URL url = getClass().getClassLoader().getResource("org/openscience/cdk/config/log4j.properties");
// debug(url.toString());
(org.apache.log4j.PropertyConfigurator).configure(url);
//(org.apache.log4j.PropertyConfigurator).configure(url);
org.apache.log4j.PropertyConfigurator.configure(url);
} catch (NoClassDefFoundError e) {
tostdout = true;
} catch (NullPointerException e) {
Expand Down

0 comments on commit ad524ca

Please sign in to comment.