Commit 180e6605 authored by balanche's avatar balanche

Ajout d'une dernière étape de progress bar lors de la classification +...

Ajout d'une dernière étape de progress bar lors de la classification + Déplacement des impémentations de progtressable dans classification.java + Suppression des scrollbars sur le panel Dataset
parent 30427990
......@@ -817,6 +817,65 @@ public abstract class Classification extends Observable implements
public void resetProgress() {
this.progress = 0;
}
@Override
public void setProgress(final int value) {
this.progress = value;
}
@Override
public void setStatus(String status)
{
this.statusName = status;
}
@Override
public String getStatus()
{
String status = "Preparing ... ";
boolean allEnded = true; //boolean for the stop condition
if(!this.progressableList.isEmpty()) {
for (int i = 0 ; i < this.progressableList.size(); i++) {
if (this.progressableList.get(i) != null) {
if (this.progressableList.get(i).getProgress() != 100) {
status = "Step "+ (i+1) + "/" + (this.progressableList.size()+1) + " : " + this.progressableList.get(i).getStatus();
allEnded = false;
}
}
}
}
if(allEnded) {//return the usual value (this.status) when all progressables are done (to monitor the final step which is displaying the result)
status = this.statusName;
}
return status;
}
@Override
public int getProgress()
{
int progress = 0;
boolean allEnded = true; //boolean for the stop condition
if(!this.progressableList.isEmpty()) {
for (Progressable p : this.progressableList) {
if(p!=null) {
if (p.getProgress() != 100) {
progress=p.getProgress();
allEnded=false;
}
}
}
}
if(allEnded) {//return the usual value (this.progress) when all progressables are done (to monitor the final step which is displaying the result)
progress = this.progress;
//System.out.println("all progressable ended");
}
return progress;
}
/**
* Add a progressable to monitor
* @param p the progressable to add
......@@ -825,6 +884,16 @@ public abstract class Classification extends Observable implements
this.progressableList.add(p);
}
/**
* Get the list of all the progressables to monitor in this classification
* @return the progressable list
*/
public ArrayList<Progressable> getProgressableList(){
return this.progressableList;
}
}
......@@ -324,9 +324,11 @@ public class SingleClassification extends Classification {
@Override
public void classify() {
/* Add all the process to monitor in the list (they have to implement progressable) */
/*
* Add all the processes to monitor in the list (they have to implement progressable)
*/
this.addProgressable(this.learningMethod);
this.addProgressable(this.learningResult);
this.addProgressable(null);// had null because this.learningResult is not defined yet
if (this.useRmi() && !this.isMaclaw()) {
if (this.sshParameters == null) {
......@@ -336,18 +338,17 @@ public class SingleClassification extends Classification {
}
} else {
if (this.learningResult == null) {
System.out.println("debut learn "+new Date().toString());
// System.out.println("debut learn "+new Date().toString());
this.learn();
System.out.println("fin learn "+new Date().toString());
// System.out.println("fin learn "+new Date().toString());
}
this.progressableList.set(1, this.learningResult);// ne se met pas à jour ??
//SEPARATION ICI ?
this.progressableList.set(1, this.learningResult);// now this.learningResult isn't null anymore so we can add him
System.out.println("debut classify "+new Date().toString());
// System.out.println("debut classify "+new Date().toString());
this.clusteringResult = this.learningResult
.classify(this.classificationData, false);
System.out.println("fin classify "+new Date().toString());
// System.out.println("fin classify "+new Date().toString());
this.clusteringResult.setMethode(this.learningMethod.getType());
/*
......@@ -469,7 +470,7 @@ public class SingleClassification extends Classification {
this.learningMethod.sshparameters = this.sshParameters;
this.learningMethod.container_ = this.container_;
}
System.out.println(this.learningMethod.getName()+" starts to learn");
// System.out.println(this.learningMethod.getName()+" starts to learn");
this.learningResult = this.learningMethod
.learn(this.classificationData);
}
......@@ -620,53 +621,8 @@ public class SingleClassification extends Classification {
return result;
}
@Override
public void setProgress(final int value) {
this.progress = value;
}
@Override
public void setStatus(String status)
{
this.statusName = status;
}
@Override
public String getStatus()
{
String status = "Preparing ... ";
if(!this.progressableList.isEmpty()) {
for (int i = 0 ; i < this.progressableList.size(); i++) {
if (this.progressableList.get(i) != null) {
if (this.progressableList.get(i).getProgress() != 100)
status = "Step "+ (i+1) + "/" + this.progressableList.size() + " : " + this.progressableList.get(i).getStatus();
}
}
}
return status;
}
@Override
public int getProgress() {
int progress = 0;
boolean allEnded = true; //boolean for the stop condition
if(!this.progressableList.isEmpty()) {
for (Progressable p : this.progressableList) {
if(p!=null) {
if (p.getProgress() != 100) {
progress=p.getProgress();
allEnded=false;
}
}
}
}
if(allEnded) {//returns 100 to stop the ProgressThread if all progressables are at 100%
progress = 100;
System.out.println("allEnded");
}
return progress;
}
}
......@@ -144,11 +144,11 @@ public class LearningResultKmeans extends LearningResult {
((LightHardSeed) this.seeds.get(i)).setId(i);
}
}
long startT = System.nanoTime();
System.out.println("start at "+startT);
// long startT = System.nanoTime();
// System.out.println("start at "+startT);
int clusterMap[] = this.clusterAffectation(data,fromSample);// !!!
long endT = System.nanoTime();
System.out.println("endat "+ endT + " total of "+ (endT - startT)/1000000000l);
// long endT = System.nanoTime();
// System.out.println("endat "+ endT + " total of "+ (endT - startT)/1000000000l);
ClusteringResult result = null;
if (((ParametersKmeans) this.params).fuzzy) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment