use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.
the class MxlBarStyleColor method read.
@NonNull
public static MxlBarStyleColor read(XmlReader reader) {
MxlColor color = MxlColor.read(reader);
MxlBarStyle barStyle = MxlBarStyle.read(reader);
return new MxlBarStyleColor(barStyle, color);
}
use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.
the class MxlNote method read.
@NonNull
public static MxlNote read(XmlReader reader) {
MxlNoteContent content = null;
MxlInstrument instrument = null;
MxlEditorialVoice editorialVoice = new MxlEditorialVoice();
MxlNoteTypeValue noteType = null;
int dots = 0;
MxlStem stem = null;
Integer staff = null;
List<MxlBeam> beams = null;
List<MxlNotations> notations = null;
List<MxlLyric> lyrics = null;
while (reader.openNextChildElement()) {
String n = reader.getElementName();
// but, be tolerant for errors, and also accept late grace or cue elements
if (n.equals(MxlGraceNote.elemName)) {
MxlGraceNote graceNote = MxlGraceNote.read(reader);
if (// grace element too late, but accept it
content instanceof MxlNormalNote)
graceNote.setFullNote(((MxlNormalNote) content).getFullNote());
content = graceNote;
} else if (n.equals(MxlCueNote.elemName)) {
MxlCueNote cueNote = MxlCueNote.read();
if (// cue element too late, but accept it
content instanceof MxlNormalNote)
cueNote.setFullNote(((MxlNormalNote) content).getFullNote());
content = cueNote;
} else if (content == null) {
content = MxlNormalNote.read();
}
// read content of child elements
switch(n) {
case MxlStem.elemName:
stem = MxlStem.read(reader);
break;
case "staff":
staff = reader.getTextIntNotNull();
break;
case MxlBeam.elemName:
if (beams == null)
beams = new ArrayList<>();
beams.add(MxlBeam.read(reader));
break;
case MxlInstrument.elemName:
instrument = MxlInstrument.read(reader);
break;
case MxlNotations.elemName:
if (notations == null)
notations = new ArrayList<>();
notations.add(MxlNotations.read(reader));
break;
case MxlLyric.elemName:
if (lyrics == null)
lyrics = new ArrayList<>();
lyrics.add(MxlLyric.read(reader));
break;
case "type":
noteType = MxlNoteTypeValue.read(reader.getText());
break;
case "dot":
dots++;
break;
default:
boolean read = content.readElement(reader);
if (!read)
editorialVoice.readElement(reader);
break;
}
reader.closeElement();
}
content.check(reader);
if (false == editorialVoice.isUsed())
editorialVoice = null;
return new MxlNote(content, instrument, editorialVoice, noteType, dots, stem, staff, beams, notations, lyrics);
}
use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.
the class MxlPageLayout method read.
@NonNull
public static MxlPageLayout read(XmlReader reader) {
Float pageWidth = null;
Float pageHeight = null;
List<MxlPageMargins> pageMargins = alist();
while (reader.openNextChildElement()) {
String n = reader.getElementName();
switch(n) {
case "page-width":
pageWidth = Parser.parseFloatNull(reader.getText());
break;
case "page-height":
pageHeight = Parser.parseFloatNull(reader.getText());
break;
case "page-margins":
pageMargins.add(MxlPageMargins.read(reader));
break;
}
reader.closeElement();
}
Size2f pageSize = (pageWidth == null && pageHeight == null ? null : new Size2f(pageWidth, pageHeight));
return new MxlPageLayout(pageSize, pageMargins);
}
use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.
the class MxlPedal method read.
@NonNull
public static MxlPedal read(XmlReader reader) {
String type = reader.getAttributeNotNull("type");
MxlPrintStyle printStyle = MxlPrintStyle.read(reader);
return new MxlPedal(MxlStartStopChange.read(type), printStyle);
}
use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.
the class MxlEnding method read.
@NonNull
public static MxlEnding read(XmlReader reader) {
String number = reader.getAttributeNotNull("number");
MxlStartStopDiscontinue type = MxlStartStopDiscontinue.read(reader.getAttributeNotNull("type"));
return new MxlEnding(number, type);
}
Aggregations