public List<Span> getFormatSpans(FormatType t){ List<Span> result = new ArrayList<Span>(); int offset = 0; for( Content c: ccl ){ for( Span b : c.getFormatSpans(t) ) result.add( b.clone().adjust( offset )); offset += 1 + c.length(); } return result; }
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; }
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; }
for( FormatType t: c.getFormats( s.clone().adjust( -offset ) ) ) switch(t){ case BOLD: