/** * @generated * @param jcas JCas to which this Feature Structure belongs * @param begin offset to the begin spot in the SofA * @param end offset to the end spot in the SofA */ public Heading(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
document.addToIndexes(); Heading h1 = new Heading(jCas); h1.setBegin(cursor); h1.setDepth(++depth); cursor += H1.length(); h1.setEnd(cursor); h1.setLevel(1); h1.addToIndexes(); ol1.addToIndexes(); Heading h2 = new Heading(jCas); h2.setBegin(cursor); h2.setDepth(++depth); cursor += H2.length(); h2.setEnd(cursor); h2.setLevel(2); h2.addToIndexes();
@Test public void testHeadings() throws UIMAException { final JCas jCas = JCasSingleton.getJCasInstance(); final StructuralAnnotations sa = new StructuralAnnotations(); final Element h1 = new Element(Tag.valueOf("h1"), ""); final Element h2 = new Element(Tag.valueOf("h2"), ""); final Element h3 = new Element(Tag.valueOf("h3"), ""); final Element h4 = new Element(Tag.valueOf("h4"), ""); final AnnotationCollector collector = new AnnotationCollector(); sa.map(jCas, h1, collector); sa.map(jCas, h2, collector); sa.map(jCas, h3, collector); sa.map(jCas, h4, collector); Heading heading1 = (Heading) collector.getAnnotations().get(0); Heading heading2 = (Heading) collector.getAnnotations().get(1); Heading heading3 = (Heading) collector.getAnnotations().get(2); Heading heading4 = (Heading) collector.getAnnotations().get(3); assertEquals(1, heading1.getLevel()); assertEquals(2, heading2.getLevel()); assertEquals(3, heading3.getLevel()); assertEquals(4, heading4.getLevel()); }
/** * Internal - constructor used by generator * * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public Heading(int addr, TOP_Type type) { super(addr, type); readObject(); }
TemplateField heading = fields.get(0); assertEquals("heading", heading.getName()); assertEquals(heading1.getBegin(), heading.getBegin()); assertEquals(heading.getBegin() + HEADING1.length(), heading.getEnd()); assertEquals(HEADING1, heading.getCoveredText()); heading = fields.get(0); assertEquals("heading", heading.getName()); assertEquals(heading2.getBegin(), heading.getBegin()); assertEquals(heading.getBegin() + HEADING2.length(), heading.getEnd()); assertEquals(HEADING2, heading.getCoveredText()); heading = fields.get(0); assertEquals("heading", heading.getName()); assertEquals(heading3.getBegin(), heading.getBegin()); assertEquals(heading.getBegin() + HEADING3.length(), heading.getEnd()); assertEquals(HEADING3, heading.getCoveredText());
heading1 = new Heading(jCas); heading1.setDepth(2); heading1.setBegin(cursor); cursor += HEADING.length(); heading1.setEnd(cursor); heading1.addToIndexes(); paragraph4.addToIndexes(); heading2 = new Heading(jCas); heading2.setDepth(2); heading2.setBegin(cursor); cursor += HEADING.length(); heading2.setEnd(cursor); heading2.addToIndexes();
} else if (s instanceof Heading) { final Heading h = (Heading) s; final int level = Math.min(6, Math.max(1, h.getLevel())); e = createElement("h" + level); } else if (s instanceof Link) {
/** * Internal - constructor used by generator * * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public Heading(int addr, TOP_Type type) { super(addr, type); readObject(); }
section.setDepth(depth); heading1 = new Heading(jCas); heading1.setBegin(cursor); heading1.setDepth(++depth); cursor += HEADING1.length(); heading1.setEnd(cursor); heading1.addToIndexes(); paragraph1.addToIndexes(); heading2 = new Heading(jCas); heading2.setBegin(++cursor); heading2.setDepth(depth); cursor += HEADING1.length(); heading2.setEnd(cursor); heading2.addToIndexes(); paragraph2.addToIndexes(); heading3 = new Heading(jCas); heading3.setBegin(++cursor); heading3.setDepth(depth); cursor += HEADING1.length(); heading3.setEnd(cursor); heading3.addToIndexes();
/** * @generated * @param jcas JCas to which this Feature Structure belongs * @param begin offset to the begin spot in the SofA * @param end offset to the end spot in the SofA */ public Heading(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
/** * @generated * @param jcas JCas to which this Feature Structure belongs */ public Heading(JCas jcas) { super(jcas); readObject(); }
/** * @generated * @param jcas JCas to which this Feature Structure belongs */ public Heading(JCas jcas) { super(jcas); readObject(); }