edu.uchsc.ccp.knowtator
Class TextSourceUtil

java.lang.Object
  extended by edu.uchsc.ccp.knowtator.TextSourceUtil

public class TextSourceUtil
extends Object

This class helps one to find a "text source" instance in the knowledgebase given a TextSource object or vice versa. In order to make this as simple to code up as possible, I made some simplifying assumptions which result in less flexibility for the user. One is that all instances of "text source" share the same namespace - and there should be no overlap - even across different types of "text source" instances. A user must know where a to find a TextSource given its name if the code cannot find it in the TextSouceCollection that it has open.


Constructor Summary
TextSourceUtil(AnnotationUtil annotationUtil, KnowtatorProjectUtil kpu)
           
 
Method Summary
 void addTextSourceChangeListener(TextSourceChangeListener textSourceChangeListener)
           
 void addTextSourceCollectionChangeListener(TextSourceCollectionChangeListener textSourceCollectionChangeListener)
          TextSourceCollection methods
 TextSource getCurrentTextSource()
           
 TextSourceCollection getCurrentTextSourceCollection()
           
 TextSource getTextSource(Instance textSourceInstance)
           
 String getTextSourceAnnotationComment(Instance textSourceInstance)
           
 String getTextSourceAnnotationComment(TextSource textSource)
           
 SimpleInstance getTextSourceInstance(TextSource textSource, boolean create)
          This method finds a "text source" instance in the knowledgebase for the given TextSouce object.
 void init()
           
 void removeTextSourceChangeListener(TextSourceChangeListener textSourceChangeListener)
           
 void removeTextSourceCollectionChangeListener(TextSourceCollectionChangeListener textSourceCollectionChangeListener)
           
 TextSourceCollection selectTextSourceCollection(Component parent)
           
 void setCurrentTextSource(TextSource textSource)
           
 void setCurrentTextSourceCollection(TextSourceCollection textSourceCollection)
           
 void setTextSourceAnnotationComment(Instance textSourceInstance, String comment)
           
 void setTextSourceAnnotationComment(TextSource textSource, String comment)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextSourceUtil

public TextSourceUtil(AnnotationUtil annotationUtil,
                      KnowtatorProjectUtil kpu)
Method Detail

init

public void init()

selectTextSourceCollection

public TextSourceCollection selectTextSourceCollection(Component parent)

getTextSourceInstance

public SimpleInstance getTextSourceInstance(TextSource textSource,
                                            boolean create)
This method finds a "text source" instance in the knowledgebase for the given TextSouce object. The "search" is very simplistic - simply return the instance in the knowledgebase that has the name textSource.getName(). The namespace of your text sources - regardless of what kind they are - should not have conflicts/overlaps

Parameters:
textSource -
create - - if true: if there is not a "text source" instance for the TextSource object then create one.
Returns:
the "text source" instance for the given TextSource object.

getTextSource

public TextSource getTextSource(Instance textSourceInstance)
                         throws TextSourceAccessException
Throws:
TextSourceAccessException

getTextSourceAnnotationComment

public String getTextSourceAnnotationComment(Instance textSourceInstance)

getTextSourceAnnotationComment

public String getTextSourceAnnotationComment(TextSource textSource)

setTextSourceAnnotationComment

public void setTextSourceAnnotationComment(Instance textSourceInstance,
                                           String comment)

setTextSourceAnnotationComment

public void setTextSourceAnnotationComment(TextSource textSource,
                                           String comment)

addTextSourceChangeListener

public void addTextSourceChangeListener(TextSourceChangeListener textSourceChangeListener)

removeTextSourceChangeListener

public void removeTextSourceChangeListener(TextSourceChangeListener textSourceChangeListener)

getCurrentTextSource

public TextSource getCurrentTextSource()

setCurrentTextSource

public void setCurrentTextSource(TextSource textSource)

addTextSourceCollectionChangeListener

public void addTextSourceCollectionChangeListener(TextSourceCollectionChangeListener textSourceCollectionChangeListener)
TextSourceCollection methods


removeTextSourceCollectionChangeListener

public void removeTextSourceCollectionChangeListener(TextSourceCollectionChangeListener textSourceCollectionChangeListener)

getCurrentTextSourceCollection

public TextSourceCollection getCurrentTextSourceCollection()

setCurrentTextSourceCollection

public void setCurrentTextSourceCollection(TextSourceCollection textSourceCollection)