87 lines
2.6 KiB
Java
87 lines
2.6 KiB
Java
//
|
|
//
|
|
// Generated by StarUML(tm) Java Add-In
|
|
//
|
|
// @ Project : Untitled
|
|
// @ File Name : Section.java
|
|
// @ Date : 20/01/2008
|
|
// @ Author :
|
|
//
|
|
//
|
|
|
|
package Documents;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
public class Section extends Element {
|
|
public String titre;
|
|
public ArrayList<Element> Elements;
|
|
|
|
public Section(int ID, String title) {
|
|
this.titre = title;
|
|
this.reference = ID;
|
|
this.Elements = new ArrayList<Element>();
|
|
this.type = "section";
|
|
}
|
|
|
|
public void addElement(Element el) {
|
|
el.Conteneur = this;
|
|
Elements.add(el);
|
|
}
|
|
|
|
public void removeElement(Element el) {
|
|
Elements.remove(el);
|
|
}
|
|
|
|
public int getOrdre() {
|
|
if(this.Conteneur == null) {
|
|
return 1;
|
|
}
|
|
else {
|
|
return this.Conteneur.Elements.indexOf(this);
|
|
}
|
|
|
|
}
|
|
|
|
public int getPoids() {
|
|
int poids = 0;
|
|
for(int i = 0; i<Elements.size();i++){
|
|
poids+= Elements.get(i).getPoids();
|
|
}
|
|
return poids;
|
|
}
|
|
|
|
public Element GetChild(int indice) {
|
|
if(Elements.size() != 0) {
|
|
return Elements.get(indice);
|
|
}
|
|
else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public String afficher() {
|
|
String rep="Element N°" + this.reference + ": " + this.type + " Titre: " + this.titre;
|
|
if(this.Conteneur != null)
|
|
{ rep+= '\n' + "Contenu par N°: " + this.Conteneur.reference; }
|
|
rep += '\n' + "Contient " + this.Elements.size() + " Elements";
|
|
rep+= '\n' + "Annotation: " + this.annotation + " Coef:" + this.coefficient;
|
|
rep += '\n' + "Poids: " + this.getPoids() + " Lv: " + this.getNiveau() + '\n';
|
|
return rep;
|
|
}
|
|
public String afficherFils() {
|
|
String rep="Element N°" + this.reference + ": " + this.type + " Titre: " + this.titre;
|
|
if(this.Conteneur != null)
|
|
{ rep+= '\n' + "Contenu par N°: " + this.Conteneur.reference; }
|
|
rep += '\n' + "Contient " + this.Elements.size() + " Elements";
|
|
rep+= '\n' + "Annotation: " + this.annotation + " Coef:" + this.coefficient;
|
|
rep += '\n' + "Poids: " + this.getPoids() + " Lv: " + this.getNiveau();
|
|
for(int i = 0; i< this.Elements.size() && !this.Elements.isEmpty() ; i++)
|
|
{
|
|
rep += '\n' + this.Elements.get(i).afficher() + '\n';
|
|
}
|
|
return rep;
|
|
}
|
|
}
|