tml.vectorspace.operations
Class AbstractOperation<E>

java.lang.Object
  extended by tml.vectorspace.operations.AbstractOperation<E>
Type Parameters:
E - The class for the result of the particular operation
All Implemented Interfaces:
Operation<E>
Direct Known Subclasses:
AbstractSummarizationOperation, CompoundNounsSummarized, FactorAnalysisPlot, GrammarChecker, LastPassage, LexiconAnalysis, PassageDistances, PassageExtractionSummarization, PassagesSimilarity, RapidAutomaticKeywordExtraction, Readability, RelationshipExtraction, Summary, TagClouds, TermExtractionSummarization

public abstract class AbstractOperation<E>
extends java.lang.Object
implements Operation<E>

Abstract class for all operations, it contains the common attributes and the start() and end() methods.

Author:
Jorge Villalon

Constructor Summary
AbstractOperation()
          Constructs a default operation with no Corpus attached to it
AbstractOperation(Corpus corpus)
          Creates a new instance with a corpus ready
 
Method Summary
 void addOperationListener(OperationListener listener)
           
 Corpus getBackgroundKnowledgeCorpus()
           
 Corpus getCorpus()
           
 int getMaxResults()
           
 java.lang.String getName()
           
 Repository getRepository()
           
 java.util.List<E> getResults()
           
 java.lang.String getResultsCSVString()
           
 int getResultsNumber()
           
 java.lang.String getResultsString(java.lang.String start, java.lang.String end, java.lang.String startLine, java.lang.String endLine, java.lang.String separator)
           
 java.lang.String[][] getResultsStringTable()
           
 java.lang.Object[][] getResultsTable()
           
 java.lang.Object[] getResultsTableHeader()
           
 java.lang.String getResultsXML()
           
 long getTimeElapsed()
           
 void printResults()
          Print results on the console
 void printResultsCSV()
          Prints the results on the console using a comma as separator
 void printResultsMatlab()
          Prints the results on the console a'la Matlab
 void removeOperationListener(OperationListener listener)
           
 void setBackgroundKnowledgeCorpus(Corpus backgroundKnowledgeCorpus)
           
 void setCorpus(Corpus corpus)
           
 void setMaxResults(int maxResults)
          Sets the maximum results the operation will return
 void start()
          Starts the operation execution
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractOperation

public AbstractOperation()
Constructs a default operation with no Corpus attached to it


AbstractOperation

public AbstractOperation(Corpus corpus)
Creates a new instance with a corpus ready

Parameters:
corpus - the corpus to process
Method Detail

getRepository

public Repository getRepository()
Returns:
the repository

addOperationListener

public void addOperationListener(OperationListener listener)
Specified by:
addOperationListener in interface Operation<E>

removeOperationListener

public void removeOperationListener(OperationListener listener)
Specified by:
removeOperationListener in interface Operation<E>

getCorpus

public Corpus getCorpus()
Specified by:
getCorpus in interface Operation<E>
Returns:
the Corpus used for the operation

getMaxResults

public int getMaxResults()
Specified by:
getMaxResults in interface Operation<E>
Returns:
the maximum results set for this operation

getName

public java.lang.String getName()
Specified by:
getName in interface Operation<E>
Returns:
the name of the operation in a human readable way

getBackgroundKnowledgeCorpus

public Corpus getBackgroundKnowledgeCorpus()
Specified by:
getBackgroundKnowledgeCorpus in interface Operation<E>
Returns:
the corpus used as background knowledge

getResults

public java.util.List<E> getResults()
Specified by:
getResults in interface Operation<E>
Returns:
the results of the operation

getResultsCSVString

public java.lang.String getResultsCSVString()
Specified by:
getResultsCSVString in interface Operation<E>
Returns:
results are presented as a set of lines separated by commas

getResultsNumber

public int getResultsNumber()
Specified by:
getResultsNumber in interface Operation<E>
Returns:
the number of results the operation got

getResultsString

public java.lang.String getResultsString(java.lang.String start,
                                         java.lang.String end,
                                         java.lang.String startLine,
                                         java.lang.String endLine,
                                         java.lang.String separator)
Parameters:
start -
end -
startLine -
endLine -
separator -
Returns:
a String containing the representation of the results

getTimeElapsed

public long getTimeElapsed()
Specified by:
getTimeElapsed in interface Operation<E>
Returns:
the time the operation took

printResults

public void printResults()
Print results on the console


printResultsCSV

public void printResultsCSV()
Prints the results on the console using a comma as separator

Specified by:
printResultsCSV in interface Operation<E>

printResultsMatlab

public void printResultsMatlab()
Prints the results on the console a'la Matlab

Specified by:
printResultsMatlab in interface Operation<E>

setCorpus

public void setCorpus(Corpus corpus)
Specified by:
setCorpus in interface Operation<E>
Parameters:
corpus - sets the Corpus that will be used for the operation

setMaxResults

public void setMaxResults(int maxResults)
Sets the maximum results the operation will return

Specified by:
setMaxResults in interface Operation<E>
Parameters:
maxResults - the maximum results the operation will return

setBackgroundKnowledgeCorpus

public void setBackgroundKnowledgeCorpus(Corpus backgroundKnowledgeCorpus)
Specified by:
setBackgroundKnowledgeCorpus in interface Operation<E>
Parameters:
backgroundKnowledgeCorpus - the corpus that will be used as background knowledge

start

public void start()
           throws java.lang.Exception
Description copied from interface: Operation
Starts the operation execution

Specified by:
start in interface Operation<E>
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getResultsTable

public java.lang.Object[][] getResultsTable()
Specified by:
getResultsTable in interface Operation<E>
Returns:
the table with the results

getResultsStringTable

public java.lang.String[][] getResultsStringTable()
Specified by:
getResultsStringTable in interface Operation<E>
Returns:
the table with the results

getResultsTableHeader

public java.lang.Object[] getResultsTableHeader()
Specified by:
getResultsTableHeader in interface Operation<E>
Returns:
the headers of the results table

getResultsXML

public java.lang.String getResultsXML()
Specified by:
getResultsXML in interface Operation<E>