📄 eaf23.java
字号:
if (id == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("TIME_SLOT"); result.setAttribute("TIME_SLOT_ID", id); result.setAttribute("TIME_VALUE", time + ""); return result; } /** Use result in time_order.appendChild(); @return a new Element TIME_SLOT without time. @param id --->documentation missing<--- (Java remark: long is not an object and therfore cannot be null.) */ public final Element newTimeSlot(String id) { if (id == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("TIME_SLOT"); result.setAttribute("TIME_SLOT_ID", id); return result; } /** Use result in annotationDocument.appendChild(); @return a new Element TIER. @param id --->documentation missing<--- @param time --->documentation missing<--- @param participant --->documentation missing<--- NULLABLE @param typeRef --->documentation missing<--- @param language --->documentation missing<--- @param parent --->documentation missing<--- NULLABLE */ public final Element newTier(String id, String participant, String typeRef, Locale language, String parent) { if (id == null) { throw new RuntimeException("EAF"); } if (typeRef == null) { throw new RuntimeException("EAF"); } if (language == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("TIER"); result.setAttribute("TIER_ID", id); if (participant != null) { result.setAttribute("PARTICIPANT", participant); } result.setAttribute("LINGUISTIC_TYPE_REF", typeRef); result.setAttribute("DEFAULT_LOCALE", language.getLanguage()); if (parent != null) { result.setAttribute("PARENT_REF", parent); } return result; } /** Use result in tier.appendChild(); @return a new Element ANNOTATION. */ public final Element newAnnotation() { Element result = this.doc.createElement("ANNOTATION"); return result; } /** Use result in annotation.appendChild(); @return a new Element ALIGNABLE_ANNOTATION. @param id --->documentation missing<--- @param beginTimeSlot --->documentation missing<--- @param endTimeSlot --->documentation missing<--- @param svgId the id of the referenced svg element */ public final Element newAlignableAnnotation(String id, String beginTimeSlot, String endTimeSlot, String svgId) { if (id == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("ALIGNABLE_ANNOTATION"); result.setAttribute("ANNOTATION_ID", id); result.setAttribute("TIME_SLOT_REF1", beginTimeSlot); result.setAttribute("TIME_SLOT_REF2", endTimeSlot); if (svgId != null) { result.setAttribute("SVG_REF", svgId); } return result; } /** Use result in annotation.appendChild(); @return a new Element REF_ANNOTATION. @param id --->documentation missing<--- @param annotationRef --->documentation missing<--- */ public final Element newRefAnnotation(String id, String annotationRef, String previousAnnotation) { if (id == null) { throw new RuntimeException("EAF"); } if (annotationRef == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("REF_ANNOTATION"); result.setAttribute("ANNOTATION_ID", id); result.setAttribute("ANNOTATION_REF", annotationRef); if (previousAnnotation != null) { result.setAttribute("PREVIOUS_ANNOTATION", previousAnnotation); } return result; } /** Use result in refAnnotation.appendChild(); @return a new Element ANNOTATION_VALUE. @param value --->documentation missing<--- */ public final Element newAnnotationValue(String value) { if (value == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("ANNOTATION_VALUE"); result.appendChild(doc.createTextNode(value)); return result; } /** Use result in annotationDocument.appendChild(); @return a new Element LINGUISTIC_TYPE. @param id --->documentation missing<--- @param controlledVocabularyName the name of the CV reference */ public final Element newLinguisticType(String id, boolean timeAlignable, boolean graphicReferences, String constraint, String controlledVocabularyName) { if (id == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("LINGUISTIC_TYPE"); result.setAttribute("LINGUISTIC_TYPE_ID", id); result.setAttribute("TIME_ALIGNABLE", timeAlignable ? "true" : "false"); result.setAttribute("GRAPHIC_REFERENCES", graphicReferences ? "true" : "false"); if (constraint != null) { result.setAttribute("CONSTRAINTS", constraint); } if (controlledVocabularyName != null) { result.setAttribute("CONTROLLED_VOCABULARY_REF", controlledVocabularyName); } return result; } /** * Use result in annotationDocument.appendChild(); * @return a new Element CONSTRAINT */ public final Element newConstraint(String stereotype, String description) { if (stereotype == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("CONSTRAINT"); result.setAttribute("STEREOTYPE", stereotype); if (description != null) { result.setAttribute("DESCRIPTION", description); } return result; } /** Use result in annotationDocument.appendChild(); @return a new Element LOCALE. @param locale --->documentation missing<--- */ public final Element newLocale(Locale l) { if (l == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("LOCALE"); result.setAttribute("LANGUAGE_CODE", l.getLanguage()); if (!l.getCountry().equals("")) { result.setAttribute("COUNTRY_CODE", l.getCountry()); } if (!l.getVariant().equals("")) { result.setAttribute("VARIANT", l.getVariant()); } return result; } /** * Use result in annotationDocument.appendChild(); * * @param conVocId the id (name) of the CV * @param description the description of the cv, can be null * * @return a new Element CONTROLLED_VOCABULARY. */ public final Element newControlledVocabulary(String conVocId, String description) { if (conVocId == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("CONTROLLED_VOCABULARY"); result.setAttribute("CV_ID", conVocId); if (description != null) { result.setAttribute("DESCRIPTION", description); } return result; } /** * Use result in annotationDocument.appendChild(); * * @param value the value of the CVEntry * @param description the description of the entry, can be null * * @return a new Element CV_ENTRY */ public final Element newCVEntry(String value, String description) { if (value == null) { throw new RuntimeException("EAF"); } Element result = this.doc.createElement("CV_ENTRY"); result.appendChild(doc.createTextNode(value)); if (description != null) { result.setAttribute("DESCRIPTION", description); } return result; } /** For Testing. */ public static void main(String[] a) throws Exception { new EAF23(true); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -