/** * Returns the Formats wich are used in this ContentElement, in the Range of the Span s, in a List. */ public List<FormatType> getFormats(Span s){ List<FormatType> result= new ArrayList<FormatType>(); for(Span s2: boldSpans) if( s.hits(s2) ){ result.add( FormatType.BOLD ); break; } for(Span s2: italicSpans) if( s.hits(s2) ){ result.add( FormatType.ITALIC ); break; } return result; }
/** * Returns a List of the Templates of this ContentElement in the Range of s */ public List<Template> getTemplates(Span s){ List<Template> result = new ArrayList<Template>(); for( Template t: templates) if( t.getPos().hits( s ) ) result.add( t ); return result; }
/** * Returns all the Spans of the Format type t in the Range of the Span s */ public List<Span> getFormatSpans(FormatType t, Span s){ List<Span> result = new ArrayList<Span>(); for( Span s2: getFormatSpans(t) ) if( s2.hits(s) )result.add( s2 ); return result; }
/** * Returns a List of the Links of this ContentElement of the Specified Link.type t in the Range of s */ public List<Link> getLinks( Link.type t, Span s){ List<Link> result = new ArrayList<Link>(); for( Link l: links) if( l.getType()==t && l.getPos().hits(s) ) result.add(l); return result; }
public List<Template> getTemplates(Span s){ List<Template> result = new ArrayList<Template>(); Span a = new Span( -1, -1 ); for( Content c: ccl ){ int offset = a.getEnd()+1; a = new Span( offset, offset+ c.length() ); if( a.hits(s) ) result.addAll( c.getTemplates( s.clone().adjust( -offset ) ) ); } return result; } }
public List<Link> getLinks( Link.type linkType, Span s){ List<Link> result = new ArrayList<Link>(); Span a = new Span( -1, -1 ); for( Content c: ccl ){ int offset = a.getEnd()+1; a = new Span( offset, offset+ c.length() ); if( a.hits(s) ) result.addAll( c.getLinks( linkType, s.clone().adjust( -offset ) ) ); } return result; }
a = new Span( offset, offset+ c.length() ); if( a.hits(s) ) for( FormatType t: c.getFormats( s.clone().adjust( -offset ) ) ) switch(t){
public List<Span> getFormatSpans(FormatType t, Span s){ List<Span> result = new ArrayList<Span>(); Span a = new Span( -1, -1 ); for( Content c: ccl ){ int offset = a.getEnd()+1; a = new Span( offset, offset+ c.length() ); if( a.hits(s) ){ for( Span b: c.getFormatSpans( t, s.clone().adjust( -offset ) ) ) result.add( b.clone().adjust( offset ) ); } } return result; }
&& lastLinkSpan.hits(new Span(linkStartTag, linkEndTag + 2)))