{
working = true;
progId = System.currentTimeMillis();
- progressBar = this;
+ progressBar = new jalview.gui.ProgressBar(statusPanel, statusBar);
String message = MessageManager
.getString("label.pasimap_recalculating");
if (getParent() == null)
updateProgressBar(progress);
}
+ public void updateProgressBarWithEta(int progress, double minutes)
+ {
+ JProgressBar pBar = progressBar.getProgressBar(progId);
+
+ if (pBar == null)
+ {
+ return;
+ }
+ int max=pBar.getMaximum();
+ progressBar.setProgressBarMessage(progId,
+ progressBar.getMessage(progId) + " ("
+ + (Double.isNaN(minutes) ? " .. working ..)"
+ : (minutes < 1.0 ? "Less than a minute)"
+ : ((int) Math.ceil(minutes)) + " mins. to go)")));
+ pBar.setMaximum(max);
+ pBar.setValue(progress);
+
+ }
public void updateProgressBar(int progress)
{
JProgressBar pBar = progressBar.getProgressBar(progId);
{
if (PairwiseAlignPanel.PROGRESS.equals(pcEvent.getPropertyName()))
{
- updateProgressBar((int) pcEvent.getNewValue());
+ updateProgressBarWithEta((int) pcEvent.getNewValue(), pap.getEta());
+
}
else if (PairwiseAlignPanel.TOTAL.equals(pcEvent.getPropertyName()))
{
final IProgressIndicatorHandler handler)
{
progressBar.registerHandler(id, handler);
- // if (progressBarHandlers == null ||
- // !progressBars.contains(Long.valueOf(id)))
- // {
- // throw new
- // Error(MessageManager.getString("error.call_setprogressbar_before_registering_handler"));
- // }
- // progressBarHandlers.put(Long.valueOf(id), handler);
- // final JPanel progressPanel = (JPanel) progressBars.get(Long.valueOf(id));
- // if (handler.canCancel())
- // {
- // JButton cancel = new JButton(
- // MessageManager.getString("action.cancel"));
- // final IProgressIndicator us = this;
- // cancel.addActionListener(new ActionListener()
- // {
- //
- // @Override
- // public void actionPerformed(ActionEvent e)
- // {
- // handler.cancelActivity(id);
- // us.setProgressBar(MessageManager.formatMessage("label.cancelled_params",
- // new String[]{((JLabel) progressPanel.getComponent(0)).getText()}), id);
- // }
- // });
- // progressPanel.add(cancel, BorderLayout.EAST);
- // }
}
/**
private ScoreMatrix scoreMatrix;
/**
+ * remaining time
+ */
+ private double etime=Double.NaN;
+
+ /**
* Creates a new PairwiseAlignPanel object.
*
* @param viewport
int count = seqs.length;
boolean first = true;
-
+ long time=System.currentTimeMillis();
progress = 0;
firePropertyChange(TOTAL, 0, total);
}
firePropertyChange(PROGRESS, progress, ++progress);
}
+ if (i<count)
+ {
+ // remaining time in minutes ~ is (elapsed time)/ 0.5*(n*n)
+ etime = 0.0001*(total-progress)*(System.currentTimeMillis()-time)/progress;
+ }
}
alignmentScores[count - 1][count - 1] = Float.NaN;
alignmentOutput = sb.toString();
}
+
+ public boolean hasEta()
+ {
+ return !Double.isNaN(etime);
+ }
+ public double getEta()
+ {
+ return etime;
+ }
+ /**
+ * stops the run() loop ASAP
+ */
+ public void cancel()
+ {
+ cancelled=true;
+ }
public float[][] getScores()
{
double totscore)
{
System.out
- .println("Pairwise alignment scaled similarity score matrix\n");
+ .println("Pairwise alignment scaled similarity score matrix"+getPairwiseSimscoresAsString()+"\n");
for (int i = 0; i < seqs.length; i++)
{
jalview.bin.Console.outPrintln("\n");
}
+
+ public String getPairwiseSimscoresAsString()
+ {
+ return (scoreMatrix != null
+ ? " (" + scoreMatrix.getName() + ", open=" + GAP_OPEN_COST
+ + ", extend=" + GAP_EXTEND_COST
+ + (endGaps ? ", with endGaps" : ", no endGaps") + ")"
+ : "");
+ }
/**
* DOCUMENT ME!
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
Desktop.addInternalFrame(af,
- MessageManager.getString("label.pairwise_aligned_sequences"),
+ MessageManager.getString("label.pairwise_aligned_sequences")+" "+getPairwiseSimscoresAsString(),
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
}