* creates a default mei tree
*
* @return
*/
public static Mei createDefaultMeiTree(int stavesCount, int measureCount) {
Mei mei = new Mei();
MeiHead meiHead = new MeiHead();
FileDesc fileDesc = new FileDesc();
TitleStmt titleStmt = new TitleStmt();
Title title = new Title();
title.getContent().add("New MEI-2013 document");
titleStmt.getTitles().add(title);
fileDesc.setTitleStmt(titleStmt);
PubStmt pubStmt = new PubStmt();
fileDesc.setPubStmt(pubStmt);
SourceDesc sourceDesc = new SourceDesc();
Source source = new Source();
sourceDesc.getSources().add(source);
fileDesc.setSourceDesc(sourceDesc);
meiHead.setFileDesc(fileDesc);
mei.setMeiHead(meiHead);
Music music = new Music();
Body body = new Body();
Mdiv mdiv = new Mdiv();
Score score = new Score();
ScoreDef scoreDef = createScoreDef(stavesCount);
score.getGapsAndSbsAndCorrs().add(scoreDef);
Section section = new Section();
Measure measureFirst = new Measure();
Staff staffFirst = new Staff();
Layer layerFirst = new Layer();
staffFirst.getSbsAndSymbolsAndOrigs().add(layerFirst);
measureFirst.getAnnotsAndSlursAndTupletSpen().add(staffFirst);
for (int stavesIter = 1; stavesIter < stavesCount; stavesIter++) {
Staff staff = new Staff();
Layer layer = new Layer();
staff.getSbsAndSymbolsAndOrigs().add(layer);
measureFirst.getAnnotsAndSlursAndTupletSpen().add(staff);
}
section.getUnclearsAndSbsAndApps().add(measureFirst);
for (int measureIter = 1; measureIter < measureCount; measureIter++) {
Measure measure = new Measure();
for (int stavesIter = 0; stavesIter < stavesCount; stavesIter++) {
Staff staff = new Staff();
Layer layer = new Layer();
staff.getSbsAndSymbolsAndOrigs().add(layer);
measure.getAnnotsAndSlursAndTupletSpen().add(staff);
}
section.getUnclearsAndSbsAndApps().add(measure);
}
score.getGapsAndSbsAndCorrs().add(section);
mdiv.setScore(score);
body.getMdivs().add(mdiv);
music.setBody(body);
mei.setMusic(music);
mei.setId(DEFAULT_MEI_TREE);
return mei;
}