gate.creole.annic
Class HTMLGenerator

java.lang.Object
  extended by gate.creole.annic.HTMLGenerator

public class HTMLGenerator
extends Object

This class provides methods to export the annic patterns to HTML. The HTML provides a way to look at various annotations that span across the found annic pattern.

Author:
niraj

Field Summary
private static int noOfColumnsToDraw
          Number of columns to draw in the html table.
 
Constructor Summary
HTMLGenerator()
           
 
Method Summary
private static String addFeatures(Map<String,String> features)
           
private static String columnsToDraw(PatternAnnotation[] currentTableAnnotations, List<PatternAnnotation> rowAnnotations, int currentPos, List<String> colPositions)
           
private static List<PatternAnnotation> findOutAnnotationsOfType(PatternAnnotation[] annotations, String type)
          From given an array of pattern annotations, this method finds out the annotations of the given type.
static String generateHTMLTable(Pattern pattern)
          This method exports the annic pattern to HTML.
private static int getColSpan(int startOffset, int endOffset, List<String> colPositions)
           
private static List<String> getColsPositions(PatternAnnotation[] annotations)
           
private static List<String> getRowData(PatternAnnotation[] annotations)
          This method return the unique rows.
private static int noOfColumnsToDraw(int start, int end, List<String> colPositions)
           
private static PatternAnnotation[] sort(PatternAnnotation[] annots)
          This method is used for sorting the pattern annotations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

noOfColumnsToDraw

private static int noOfColumnsToDraw
Number of columns to draw in the html table.

Constructor Detail

HTMLGenerator

public HTMLGenerator()
Method Detail

generateHTMLTable

public static String generateHTMLTable(Pattern pattern)
This method exports the annic pattern to HTML. The HTML provides a way to look at various annotations that span across the found annic pattern.

Parameters:
pattern -
Returns:

sort

private static PatternAnnotation[] sort(PatternAnnotation[] annots)
This method is used for sorting the pattern annotations.

Parameters:
annots -
Returns:

columnsToDraw

private static String columnsToDraw(PatternAnnotation[] currentTableAnnotations,
                                    List<PatternAnnotation> rowAnnotations,
                                    int currentPos,
                                    List<String> colPositions)

noOfColumnsToDraw

private static int noOfColumnsToDraw(int start,
                                     int end,
                                     List<String> colPositions)

findOutAnnotationsOfType

private static List<PatternAnnotation> findOutAnnotationsOfType(PatternAnnotation[] annotations,
                                                                String type)
From given an array of pattern annotations, this method finds out the annotations of the given type.

Parameters:
annotations -
type -
Returns:

getColSpan

private static int getColSpan(int startOffset,
                              int endOffset,
                              List<String> colPositions)

getColsPositions

private static List<String> getColsPositions(PatternAnnotation[] annotations)

getRowData

private static List<String> getRowData(PatternAnnotation[] annotations)
This method return the unique rows. Each row refers to a different annotation type

Parameters:
annotations -
Returns:
a list of string objects referring to the annotation types

addFeatures

private static String addFeatures(Map<String,String> features)