/** * @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 Link(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
quotation2.addToIndexes(); link1 = new Link(jCas); link1.setBegin(++cursor); link1.setDepth(depth); cursor += LINK.length(); link1.setEnd(cursor); link1.addToIndexes(); quotation4.addToIndexes(); link2 = new Link(jCas); link2.setBegin(++cursor); link2.setDepth(depth); cursor += LINK.length(); link2.setEnd(cursor); link2.addToIndexes(); link3 = new Link(jCas); link3.setBegin(++cursor); link3.setDepth(depth); cursor += LINK.length(); link3.setEnd(cursor); link3.addToIndexes();
private Structure createAnchor(final JCas jCas, final Element element) { String href = element.absUrl("href"); if (Strings.isNullOrEmpty(href)) { href = element.attr("href"); } if (!Strings.isNullOrEmpty(href)) { final Link l = new Link(jCas); l.setTarget(href); return l; } else { return new Anchor(jCas); } }
@Test public void testLink() throws UIMAException { final JCas jCas = JCasSingleton.getJCasInstance(); final StructuralAnnotations sa = new StructuralAnnotations(); final Element a1 = new Element(Tag.valueOf("a"), ""); a1.attr("href", "http://example.com"); final Element a2 = new Element(Tag.valueOf("a"), ""); a2.attr("href", "/example.com"); final AnnotationCollector collector = new AnnotationCollector(); sa.map(jCas, a1, collector); sa.map(jCas, a2, collector); Annotation link = collector.getAnnotations().get(0); assertTrue(link instanceof Link); assertEquals("http://example.com", ((Link) link).getTarget()); Annotation link2 = collector.getAnnotations().get(1); assertTrue(link2 instanceof Link); assertEquals("/example.com", ((Link) link2).getTarget()); }
assertEquals("quote1", r1.getName()); assertEquals(0, r1.getBegin()); assertEquals(link1.getBegin(), r1.getEnd()); assertEquals(link1.getEnd(), r2.getBegin()); assertEquals(link2.getBegin(), r2.getEnd()); assertEquals(link2.getEnd(), r3.getBegin()); assertEquals(link3.getBegin(), r3.getEnd()); assertEquals(link3.getEnd(), r4.getBegin()); assertEquals(table.getBegin(), r4.getEnd());
/** * Internal - constructor used by generator * * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public Link(int addr, TOP_Type type) { super(addr, type); readObject(); }
quotation2.addToIndexes(); link1 = new Link(jCas); link1.setBegin(++cursor); link1.setDepth(depth); cursor += LINK.length(); link1.setEnd(cursor); link1.addToIndexes(); quotation4.addToIndexes(); link2 = new Link(jCas); link2.setBegin(++cursor); link2.setDepth(depth); cursor += LINK.length(); link2.setEnd(cursor); link2.addToIndexes(); link3 = new Link(jCas); link3.setBegin(++cursor); link3.setDepth(depth); cursor += LINK.length(); link3.setEnd(cursor); link3.addToIndexes();
private Structure createAnchor(final JCas jCas, final Element element) { String href = element.absUrl("href"); if (Strings.isNullOrEmpty(href)) { href = element.attr("href"); } if (!Strings.isNullOrEmpty(href)) { final Link l = new Link(jCas); l.setTarget(href); return l; } else { return new Anchor(jCas); } }
} else if (s instanceof Link) { e = createElement("a"); final String target = ((Link) s).getTarget(); if (!Strings.isNullOrEmpty(target)) { e.attr("href", target);
/** * @generated * @param jcas JCas to which this Feature Structure belongs */ public Link(JCas jcas) { super(jcas); readObject(); }
/** * @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 Link(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
/** * @generated * @param jcas JCas to which this Feature Structure belongs */ public Link(JCas jcas) { super(jcas); readObject(); }
/** * Internal - constructor used by generator * * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public Link(int addr, TOP_Type type) { super(addr, type); readObject(); }