當前位置: 首頁>>代碼示例>>Java>>正文


Java Table類代碼示例

本文整理匯總了Java中de.tudarmstadt.ukp.wikipedia.parser.Table的典型用法代碼示例。如果您正苦於以下問題:Java Table類的具體用法?Java Table怎麽用?Java Table使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Table類屬於de.tudarmstadt.ukp.wikipedia.parser包,在下文中一共展示了Table類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkRange

import de.tudarmstadt.ukp.wikipedia.parser.Table; //導入依賴的package包/類
private static void checkRange( SectionContent s ){
	List<SrcSpan> eil = new ArrayList<SrcSpan>();
	
	if( s.getTitleElement()!= null ){
		checkRange( s.getTitleElement() );
		eil.add( s.getTitleElement().getSrcSpan() );
	}
			
	for( Paragraph p: s.getParagraphs() ){
		checkRange( p );
		eil.add( p.getSrcSpan() );
	}
	
	for( DefinitionList dl: s.getDefinitionLists() ){
		checkRange( dl );
		eil.add( dl.getSrcSpan() );
	}

	for( NestedListContainer nl: s.getNestedLists() ){
		checkRange( nl );
		eil.add( nl.getSrcSpan() );
	}

	for( Table t: s.getTables() ){
		checkRange( t );
		eil.add( t.getSrcSpan() );
	}
	
	s.setSrcSpan( getEvalInfo( s.getSrcSpan(), eil));
}
 
開發者ID:dkpro,項目名稱:dkpro-jwpl,代碼行數:31,代碼來源:SrcPosRangeChecker.java

示例2: eliminateEmptyStructures

import de.tudarmstadt.ukp.wikipedia.parser.Table; //導入依賴的package包/類
/**
 * Removes all empty Structures from a SectionContent and all substructures.
 */
public static SectionContent eliminateEmptyStructures( SectionContent sc ){

	for( int i=sc.nrOfParagraphs()-1; i>=0; i-- ){
		Paragraph p = sc.getParagraph(i);
		if( p.empty() ) sc.removeParagraph( p );
	}
	
	for( int i=sc.nrOfDefinitionLists()-1; i>=0; i--){
		DefinitionList dl = sc.getDefinitionList(i);
		eliminateEmptyStructures( dl );
		if( dl.empty() ) sc.removeDefinitionList( dl );
	}
	
	for( int i=sc.nrOfNestedLists()-1; i>=0; i--){
		NestedListContainer nl = sc.getNestedList(i);
		eliminateEmptyStructures( nl );
		if( nl.empty() ) sc.removeNestedList( nl );
	}
	
	for( int i=sc.nrOfTables()-1; i>=0; i--){
		Table t = sc.getTable(i);
		eliminateEmptyStructures( t );
		if( t.empty() ) sc.removeTable( t );
	}
	
	return sc;
}
 
開發者ID:dkpro,項目名稱:dkpro-jwpl,代碼行數:31,代碼來源:EmptyStructureRemover.java

示例3: sectionCCLToHtml

import de.tudarmstadt.ukp.wikipedia.parser.Table; //導入依賴的package包/類
private static String sectionCCLToHtml( Section s ){
	StringBuilder result = new StringBuilder();

	if( s.getClass() == SectionContainer.class ){
		for( Section ss: ((SectionContainer)s).getSubSections() ) {
			result.append( sectionToHtml( ss ));
		}
	}
	else{
		List<Content> ccl = s.getContentList();
		for( int i=(s.getTitleElement()!=null?1:0); i<ccl.size(); i++  ){
			Content c = ccl.get(i);
			Class cc = c.getClass();
			if( cc == Paragraph.class ) {
				result.append( paragraphToHtml( (Paragraph)c ) );
			}
			else if( cc == DefinitionList.class ) {
				result.append( definitionListToHtml( (DefinitionList)c ) );
			}
			else if( cc == NestedListContainer.class ) {
				result.append( nestedListToHtml( (NestedList)c ) );
			}
			else if( cc == Table.class ) {
				result.append( tableToHtml( (Table)c ) );
			}
			else {
				result.append("\n<pre>UNKNOWN CLASS: "+cc+"\n"+ convertTags( c.toString() )+"</pre>\n");
			}
		}
	}

	return result.toString();
}
 
開發者ID:dkpro,項目名稱:dkpro-jwpl,代碼行數:34,代碼來源:HtmlWriter.java

示例4: tableToHtml

import de.tudarmstadt.ukp.wikipedia.parser.Table; //導入依賴的package包/類
/**
 * Generates HTML Output for a Table.
 */
private static String tableToHtml( Table t ){

	if( t == null ) {
		return "null";
	}

	StringBuilder result = new StringBuilder();

	int colspan;
	try{
		colspan = t.getTableElement( t.nrOfTableElements()-1 ).getCol()+1;
	}catch( Exception e){
		colspan = 1;
	}

	result.append("<table class=\"Table\">\n<tr><th colspan="+colspan+" class=\"Table\">Table");

	if( t.getTitleElement()!=null ) {
		result.append( contentElementToHtml( t.getTitleElement() ) );
	}

	result.append("</th></tr>\n<tr>\n");

	int row = 0;
	for( int i=0; i<t.nrOfTableElements(); i++ ){
		TableElement td = t.getTableElement(i);
		if( td.getRow() > row ){
			result.append( "</tr><tr>\n");
			row = td.getRow();
		}

		result.append( "<td class=\"Table\">\n" + tableElementToHtml( td ) +"</td>\n" );
	}

	result.append("</tr>\n</table>\n");
	return result.toString();
}
 
開發者ID:dkpro,項目名稱:dkpro-jwpl,代碼行數:41,代碼來源:HtmlWriter.java

示例5: checkRange

import de.tudarmstadt.ukp.wikipedia.parser.Table; //導入依賴的package包/類
private static void checkRange( SectionContent s ){
	List<SrcSpan> eil = new ArrayList<SrcSpan>();
	
	if( s.getTitleElement()!= null ){
		checkRange( s.getTitleElement() );
		eil.add( s.getTitleElement().getSrcSpan() );
	}
			
	for( Paragraph p: s.getParagraphs() ){ 
		checkRange( p );
		eil.add( p.getSrcSpan() );
	}
	
	for( DefinitionList dl: s.getDefinitionLists() ){
		checkRange( dl );
		eil.add( dl.getSrcSpan() );
	}

	for( NestedListContainer nl: s.getNestedLists() ){
		checkRange( nl );
		eil.add( nl.getSrcSpan() );
	}

	for( Table t: s.getTables() ){
		checkRange( t );
		eil.add( t.getSrcSpan() );
	}
	
	s.setSrcSpan( getEvalInfo( s.getSrcSpan(), eil));
}
 
開發者ID:fauconnier,項目名稱:LaToe,代碼行數:31,代碼來源:SrcPosRangeChecker.java

示例6: handleSection

import de.tudarmstadt.ukp.wikipedia.parser.Table; //導入依賴的package包/類
private void handleSection( Section s, StringBuilder sb ){
	EnumMap<SIT, EnumMap<CIT, Boolean>> hp = null;
	
	if( s.getTitle()!= null ) hp = sectionHandling.get( SectionType.USER_SECTION.toString()+s.getTitle().toUpperCase() );
	if( hp == null ) hp = sectionHandling.get(SectionType.SECTION_LEVEL.toString()+(s.getLevel()-levelModifier));
	if( hp == null ) hp = sectionHandling.get(SectionType.DEFAULT_SECTION.toString());
	if( hp == null ){
		System.err.println( "Cannot get Handling Parameters for Section:\""+ s.getTitle()+"\" Level:"+s.getLevel() );
		return;
	}

	handleContent( s.getTitleElement(), hp.get( SIT.TITLE ), sb );
	
	if( s.getClass() == SectionContainer.class ){
		if( hp.get( SIT.SUBS )!= null )
			handleContent( s, hp.get( SIT.SUBS ), sb );
		else
			for( Section ss: ((SectionContainer)s).getSubSections() )
				handleSection( ss, sb );
	}
	else{			
		EnumMap<CIT, Boolean> hpx;
		
		hpx = hp.get( SIT.TABLE );
		if( hpx != null )
			for( Table t: s.getTables() )
				handleContent( t, hpx, sb );
		
		hpx = hp.get( SIT.NESTLIST );
		if( hpx != null )
			for( NestedList nl: s.getNestedLists() )
				handleContent( nl, hpx, sb );
		
		hpx = hp.get( SIT.PARA );
		if( hpx != null )
			for( Paragraph p: s.getParagraphs() )
				handleContent( p, hpx, sb );
		
		hpx = hp.get( SIT.DEFLIST );
		if( hpx != null )
			for( DefinitionList dl: s.getDefinitionLists() )
				handleContent( dl, hpx, sb );
	}
}
 
開發者ID:dkpro,項目名稱:dkpro-jwpl,代碼行數:45,代碼來源:SelectiveAccessHandler.java

示例7: handleSection

import de.tudarmstadt.ukp.wikipedia.parser.Table; //導入依賴的package包/類
private void handleSection( Section s, StringBuilder sb ){
	EnumMap<SIT, EnumMap<CIT, Boolean>> hp = null;
	
	if( s.getTitle()!= null ) hp = sectionHandling.get( SectionType.USER_SECTION.toString()+s.getTitle().toUpperCase() );
	if( hp == null ) hp = sectionHandling.get(SectionType.SECTION_LEVEL.toString()+(s.getLevel()-levelModifier));
	if( hp == null ) hp = sectionHandling.get(SectionType.DEFAULT_SECTION.toString());
	if( hp == null ){
		System.err.println( "Cannot get Handling Parameters for Section:\""+ s.getTitle()+"\" Level:"+s.getLevel() );
		return;
	}

	handleContent( s.getTitleElement(), hp.get( SIT.TITLE ), sb );
	
	if( s.getClass() == SectionContainer.class ){
		if( hp.get( SIT.SUBS )!= null ) 
			handleContent( s, hp.get( SIT.SUBS ), sb );
		else 
			for( Section ss: ((SectionContainer)s).getSubSections() )
				handleSection( ss, sb );
	}
	else{			
		EnumMap<CIT, Boolean> hpx;
		
		hpx = hp.get( SIT.TABLE );
		if( hpx != null )
			for( Table t: s.getTables() )
				handleContent( t, hpx, sb );
		
		hpx = hp.get( SIT.NESTLIST );
		if( hpx != null )
			for( NestedList nl: s.getNestedLists() )
				handleContent( nl, hpx, sb );
		
		hpx = hp.get( SIT.PARA );
		if( hpx != null )
			for( Paragraph p: s.getParagraphs() )
				handleContent( p, hpx, sb );
		
		hpx = hp.get( SIT.DEFLIST );
		if( hpx != null )
			for( DefinitionList dl: s.getDefinitionLists() )
				handleContent( dl, hpx, sb );
	}
}
 
開發者ID:fauconnier,項目名稱:LaToe,代碼行數:45,代碼來源:SelectiveAccessHandler.java


注:本文中的de.tudarmstadt.ukp.wikipedia.parser.Table類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。