net.sourceforge.nite.nom.nomwrite.impl
Class NOMWriteContext

java.lang.Object
  extended by net.sourceforge.nite.nom.nomwrite.impl.NOMWriteContext
All Implemented Interfaces:
NOMContext

public class NOMWriteContext
extends java.lang.Object
implements NOMContext

NOMWriteContext holds information about the currently loaded files.

Author:
jonathan

Field Summary
 
Fields inherited from interface net.sourceforge.nite.nom.nomwrite.NOMContext
METADATA, METADATA_MULTI, RESOURCE, RESOURCE_MULTI, UNLOADED
 
Constructor Summary
NOMWriteContext(NOMCorpus corpus)
          constructor takes the NOM that we have information about
 
Method Summary
 void addFile(java.lang.String observation, NFile nfile, java.lang.String filename, int type, NResource resource, java.lang.String annotator)
          add a loaded file to the context store - caller must work out type and should pass resource only if it's a resource load and annotator only if it's an old-style multi-annotator load.
 void clear()
          clear information about loaded data
 void clear(java.lang.String observation)
          clear information about loaded data for the given observation
 java.util.List getAnnotators(java.lang.String observation, NFile nfile)
          only returns a non-null List if the load type is METADATA_MULTI - if so, returns a List of String elements: the annotators IDs
 java.util.List getLoadedNFilesForObservation(java.lang.String observation)
          return a List of NFile elements that have some loaded data corresponding to them for the given observation name.
 java.util.List getLoadedObservationNames()
           
 int getLoadType(java.lang.String observation, NFile nfile)
           
 NResource getResource(java.lang.String observation, NFile nfile)
          only returns a non-null List if the load type RESOURCE - if so, returns the NResource itself
 java.util.List getResourceDescriptions(java.lang.String observation, NFile nfile)
          Only returns a non-null List if the type is RESOURCE or RESOURCE_MULTI - return all resources loaded for this combination of observation and NFile as a List of Strings: the result of calling getDescription on each NResource.
 java.util.List getResourceIDs(java.lang.String observation, NFile nfile)
          Only returns a non-null List if the type is RESOURCE or RESOURCE_MULTI - return all resources loaded for this combination of observation and NFile as a List of Strings: the result of calling getID on each NResource.
 java.util.Set getResources(java.lang.String observation, NFile nfile)
          Only returns a non-null Set if the type is RESOURCE or RESOURCE_MULTI - return all resources loaded for this combination of observation and NFile as a Set of NResource elements.
 java.lang.String getTextualContext()
          return a String containing the context in plain text - formatted for human reading
 java.util.List getUnloadedNFilesForObservation(java.lang.String observation)
          return a List of NFile elements that have no loaded data corresponding to them for the given observation name.
 java.lang.String getXMLContext()
          return an XML formatted String containing the context
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NOMWriteContext

public NOMWriteContext(NOMCorpus corpus)
constructor takes the NOM that we have information about

Method Detail

getLoadedObservationNames

public java.util.List getLoadedObservationNames()
Specified by:
getLoadedObservationNames in interface NOMContext

getLoadType

public int getLoadType(java.lang.String observation,
                       NFile nfile)
Specified by:
getLoadType in interface NOMContext

getAnnotators

public java.util.List getAnnotators(java.lang.String observation,
                                    NFile nfile)
only returns a non-null List if the load type is METADATA_MULTI - if so, returns a List of String elements: the annotators IDs

Specified by:
getAnnotators in interface NOMContext

getResource

public NResource getResource(java.lang.String observation,
                             NFile nfile)
only returns a non-null List if the load type RESOURCE - if so, returns the NResource itself

Specified by:
getResource in interface NOMContext

getResources

public java.util.Set getResources(java.lang.String observation,
                                  NFile nfile)
Only returns a non-null Set if the type is RESOURCE or RESOURCE_MULTI - return all resources loaded for this combination of observation and NFile as a Set of NResource elements.

Specified by:
getResources in interface NOMContext

getResourceDescriptions

public java.util.List getResourceDescriptions(java.lang.String observation,
                                              NFile nfile)
Only returns a non-null List if the type is RESOURCE or RESOURCE_MULTI - return all resources loaded for this combination of observation and NFile as a List of Strings: the result of calling getDescription on each NResource.

Specified by:
getResourceDescriptions in interface NOMContext

getResourceIDs

public java.util.List getResourceIDs(java.lang.String observation,
                                     NFile nfile)
Only returns a non-null List if the type is RESOURCE or RESOURCE_MULTI - return all resources loaded for this combination of observation and NFile as a List of Strings: the result of calling getID on each NResource.

Specified by:
getResourceIDs in interface NOMContext

getLoadedNFilesForObservation

public java.util.List getLoadedNFilesForObservation(java.lang.String observation)
return a List of NFile elements that have some loaded data corresponding to them for the given observation name. This will not contain any corpus level files loaded unless the observation String is null.

Specified by:
getLoadedNFilesForObservation in interface NOMContext

getUnloadedNFilesForObservation

public java.util.List getUnloadedNFilesForObservation(java.lang.String observation)
return a List of NFile elements that have no loaded data corresponding to them for the given observation name. This will not contain any unloaded corpus level files unless the observation String is null.

Specified by:
getUnloadedNFilesForObservation in interface NOMContext

getTextualContext

public java.lang.String getTextualContext()
return a String containing the context in plain text - formatted for human reading

Specified by:
getTextualContext in interface NOMContext

getXMLContext

public java.lang.String getXMLContext()
return an XML formatted String containing the context

Specified by:
getXMLContext in interface NOMContext

clear

public void clear()
clear information about loaded data

Specified by:
clear in interface NOMContext

clear

public void clear(java.lang.String observation)
clear information about loaded data for the given observation

Specified by:
clear in interface NOMContext

addFile

public void addFile(java.lang.String observation,
                    NFile nfile,
                    java.lang.String filename,
                    int type,
                    NResource resource,
                    java.lang.String annotator)
add a loaded file to the context store - caller must work out type and should pass resource only if it's a resource load and annotator only if it's an old-style multi-annotator load.

Specified by:
addFile in interface NOMContext