-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFichier.java
More file actions
51 lines (38 loc) · 1.07 KB
/
Fichier.java
File metadata and controls
51 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import java.io.Serializable;
import javax.swing.ImageIcon;
import javax.swing.tree.TreeNode;
public abstract class Fichier implements TreeNode, Serializable, Comparable<Fichier> {
protected String nomFichier;
protected Dossier dossierParent;
public Fichier(String nomFichier) {
super();
this.nomFichier = nomFichier;
this.dossierParent = null;
}
public String getNomFormat() {
return StringVerif.alphanum(nomFichier);
}
public String getNomFichier() {
return nomFichier;
}
public void setNomFichier(String nomFichier) {
this.nomFichier = nomFichier;
}
public String toString() {
return this.getNomFichier();
}
public Dossier getDossierParent() {
return dossierParent;
}
public void setDossierParent(Dossier dossierParent) {
this.dossierParent = dossierParent;
}
public int compareTo(Fichier fichier) {
int diff = this.nomFichier.compareTo(fichier.nomFichier);
if (fichier instanceof Dossier && !(this instanceof Dossier))
diff -= 1000;
else if (this instanceof Dossier && !(fichier instanceof Dossier))
diff += 1000;
return diff;
}
}