Skip to content
Snippets Groups Projects
Commit d33d87c7 authored by Matias Mennecart's avatar Matias Mennecart
Browse files

Add classes structure

parent 92c6317d
No related branches found
No related tags found
No related merge requests found
package fr.univlille.sae.classification;
public class ClassificationApp {
public static void main(String[] args) {
}
}
package fr.univlille.sae.classification;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class ClassificationModel {
private List<LoadableData> datas;
public ClassificationModel() {
this.datas = new ArrayList<>();
}
/**
* TODO
* @param x
* @param y
*/
private void ajouterDonnee(double x, double y) {
}
/**
* TODO
* @param file
*/
private void loadData(File file) {
}
/**
* TODO
* @param data
*/
private void classifierDonnee(LoadableData data) {
}
}
package fr.univlille.sae.classification;
import java.util.Set;
public class Iris extends LoadableData{
private double sepalWidth;
private double sepalLength;
private double petalWidth;
private double petalLength;
private static Set<String> classificationTypes;
private String classification;
public Iris(double sepalWidth, double sepalLength, double petalWidth, double petalLength) {
this(sepalWidth, sepalLength, petalWidth, petalLength, "undefined");
}
public Iris(double sepalWidth, double sepalLength, double petalWidth, double petalLength, String classification) {
this.sepalWidth = sepalWidth;
this.sepalLength = sepalLength;
this.petalWidth = petalWidth;
this.petalLength = petalLength;
this.classification = classification;
}
@Override
public String getClassification() {
return this.classification;
}
@Override
public Set<String> getClassificationTypes() {
return classificationTypes;
}
public double getSepalWidth() {
return sepalWidth;
}
public double getSepalLength() {
return sepalLength;
}
public double getPetalWidth() {
return petalWidth;
}
public double getPetalLength() {
return petalLength;
}
}
package fr.univlille.sae.classification;
import java.util.List;
import java.util.Set;
public abstract class LoadableData {
public abstract String getClassification();
public abstract Set<String> getClassificationTypes();
}
package fr.univlille.sae.classification.utils;
import java.util.Collection;
import java.util.HashSet;
public abstract class Observable {
protected Collection<Observer> attached = new HashSet<>();
protected Collection<Observer> toDetach = new HashSet<>();
public void attach(Observer obs) {
attached.add(obs);
}
public void detach(Observer obs) {
this.toDetach.add(obs);
}
protected void notifyObservers() {
this.updateList();
for (Observer o : attached) {
o.update(this);
}
}
protected void notifyObservers(Object data) {
this.updateList();
for (Observer o : attached) {
o.update(this, data);
}
}
private void updateList() {
this.attached.removeAll(toDetach);
this.toDetach.clear();
}
}
package fr.univlille.sae.classification.utils;
public interface Observer {
void update(Observable observable);
void update(Observable observable, Object data);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment