Skip to content

Commit

Permalink
added estimated time remaining text
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalv committed Jun 14, 2012
1 parent f037c28 commit 963af87
Showing 1 changed file with 16 additions and 3 deletions.
@@ -1,5 +1,6 @@
/* *****************************************************************************
* Copyright (c) 2009 Ola Spjuth.
* 2012 Jonathan Alvarsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -30,6 +31,7 @@
import net.bioclipse.core.ResourcePathTransformer;
import net.bioclipse.core.business.BioclipseException;
import net.bioclipse.core.domain.IMolecule;
import net.bioclipse.core.util.TimeCalculator;
import net.bioclipse.managers.business.IBioclipseManager;
import net.bioclipse.ui.business.Activator;
import net.bioclipse.ui.business.IUIManager;
Expand Down Expand Up @@ -108,6 +110,7 @@ public List<ICDKMolecule> generateMultiple3Dconformations(
monitor.beginTask("Balloon conformation generation", molecules.size());

int i=0;
long before = System.currentTimeMillis();
for (IMolecule mol : molecules){
i++;

Expand All @@ -124,8 +127,13 @@ public List<ICDKMolecule> generateMultiple3Dconformations(
logger.error("Balloon failed on mol " + i + ". Reason: " + e.getMessage());
}
monitor.worked(1);
if (i%5==0)
monitor.subTask("Processed: " + i + "/" + molecules.size() +" molecules");
if (i%5==0) {
int size = molecules.size();
monitor.subTask(
"Processed: " + i + "/" + size +" molecules ("
+ TimeCalculator.generateTimeRemainEst(before, i, size)
+ ")" );
}
}

monitor.done();
Expand Down Expand Up @@ -638,6 +646,7 @@ public void run() {
return;
}
long pos = 1;
long before = System.currentTimeMillis();
LinkedList<MolPos> buffer = new LinkedList<MolPos>();
int foundPoinsions = 0;
while ( !buffer.isEmpty() || foundPoinsions < numberOfThreads ) {
Expand Down Expand Up @@ -674,7 +683,11 @@ public void run() {
}
++pos;
monitor.worked( 1 );
monitor.subTask( "Done " + pos + "/" + numOfMolcules );
monitor.subTask(
"Done " + pos + "/" + numOfMolcules
+ " (" + TimeCalculator.generateTimeRemainEst(
before, (int)pos, numOfMolcules ) + ")" );

List<ICDKMolecule> molecules =
cdk.loadMolecules( input.file );
ICDKMolecule molecule = molecules.get(0);
Expand Down

0 comments on commit 963af87

Please sign in to comment.