Class XCASSerializer.XCASDocSerializer

java.lang.Object
org.apache.uima.cas.impl.XCASSerializer.XCASDocSerializer
Enclosing class:
XCASSerializer

private class XCASSerializer.XCASDocSerializer extends Object
Use an inner class to hold the data for serializing a CAS. Each call to serialize() creates its own instance.
  • Field Details

    • ch

      private ContentHandler ch
    • cas

      private CASImpl cas
    • queued

      private final Map<TOP,Integer> queued
      Any FS reference we've touched goes in here. value is index repo (first one?), or MULTIPLY_INDEXED
    • NOT_INDEXED

      private static final int NOT_INDEXED
      See Also:
    • MULTIPLY_INDEXED

      private static final int MULTIPLY_INDEXED
      See Also:
    • INVALID_INDEX

      private static final int INVALID_INDEX
      See Also:
    • duplicates

      private final Map<TOP,Integer> duplicates
      Any FS indexed in more than one IR goes in here, the value is the associated duplicate key, Key is used to index into dupVectors
    • numDuplicates

      int numDuplicates
      A key identifying a particular FS indexed in multiple indexes. Starts a 0, incr by 1 for each new FS discovered to be indexed in more than one IR
    • dupVectors

      final List<IntVector> dupVectors
      list of IntVectors holding lists of repo numbers. Indexed by the key above, for fss that are in multiple index repos
    • indexedFSs

      private final List<TOP> indexedFSs
      list of FSs that are in an index somewhere.
    • indexReps

      private final IntVector indexReps
      Specific IndexRepository for indexed FSs
    • queue

      private final Deque<TOP> queue
      The current queue for FSs to write out.
    • emptyAttrs

      private final AttributesImpl emptyAttrs
    • workAttrs

      private AttributesImpl workAttrs
    • cdataType

      private static final String cdataType
      See Also:
    • fsCount

      private int fsCount
    • mOutOfTypeSystemData

      private OutOfTypeSystemData mOutOfTypeSystemData
    • KEY_AND_VALUE_MATCH

      private static final int KEY_AND_VALUE_MATCH
      See Also:
    • KEY_ONLY_MATCH

      private static final int KEY_ONLY_MATCH
      See Also:
    • KEY_NOT_FOUND

      private static final int KEY_NOT_FOUND
      See Also:
  • Constructor Details

  • Method Details

    • enqueue

      private boolean enqueue(TOP fs)
      Add an address to the queue.
      Parameters:
      fs_id - The address.
      Returns:
      false iff we've seen this address before.
    • enqueueIndexed

      private void enqueueIndexed(TOP fs, int indexRep)
      Same as enqueue, but for indexed FSs.
      Parameters:
      fs_id - The address to enqueue.
    • isQueued

      private int isQueued(TOP fs, int value)
      Bad name; check if we've seen this (address, value) before.
      Parameters:
      fs - The Feature Structure.
      value - The index repository
      Returns:
      KEY_AND_VALUE_MATCH iff we've seen (address, value) before. KEY_NOT_FOUND iff the address has not been seen before. KEY_ONLY_MATCH iff the address has been seen before with a different value.
    • serialize

      private void serialize(boolean encodeDoc, OutOfTypeSystemData outOfTypeSystemData) throws IOException, SAXException
      Throws:
      IOException
      SAXException
    • addText

      private void addText(String text) throws SAXException
      Throws:
      SAXException
    • replaceInvalidXmlChars

      private String replaceInvalidXmlChars(String aString)
    • isValidXmlChar

      private boolean isValidXmlChar(char c)
    • addAttribute

      private void addAttribute(AttributesImpl attrs, String attrName, String attrValue)
    • startElement

      private void startElement(String tag, Attributes attrs, int num) throws SAXException
      Throws:
      SAXException
    • endElement

      private void endElement(String tag) throws SAXException
      Throws:
      SAXException
    • encodeIndexed

      private void encodeIndexed() throws IOException, SAXException
      Throws:
      IOException
      SAXException
    • enqueueIndexed

      private void enqueueIndexed()
      Push the indexed FSs onto the queue.
    • enqueueArray

      private void enqueueArray(TOP[] fss, int sofaNum)
    • enqueueCollection

      private void enqueueCollection(Collection<TOP> fss, int sofaNum)
    • enqueueFeaturesOfIndexed

      private void enqueueFeaturesOfIndexed()
    • encodeQueued

      private void encodeQueued() throws IOException, SAXException
      Throws:
      IOException
      SAXException
    • encodeFS

      private void encodeFS(TOP fs, IntVector indexRep) throws IOException, SAXException
      Encode an individual FS.
      Parameters:
      fs_id - The address to be encoded.
      isIndexed - If the FS is indexed or not.
      Throws:
      IOException - passthru
      SAXException - passthru
    • encodePrimitiveTypeArrayFS

      private void encodePrimitiveTypeArrayFS(String[] data, String typeName, AttributesImpl attrs) throws SAXException
      Throws:
      SAXException
    • encodeFSArray

      private void encodeFSArray(FSArray fs, AttributesImpl attrs) throws SAXException
      Throws:
      SAXException
    • enqueueFSArray

      private void enqueueFSArray(FSArray fs)
    • encodeFeatures

      private void encodeFeatures(TOP fs, AttributesImpl attrs)
    • enqueueFeatures

      private void enqueueFeatures(TOP fs, int heapValue)
    • encodeOutOfTypeSystemFeatures

      private void encodeOutOfTypeSystemFeatures(TOP fs, AttributesImpl attrs)
    • enqueueOutOfTypeSystemFeatures

      private void enqueueOutOfTypeSystemFeatures(TOP fs)
    • getTypeName

      private final String getTypeName(TOP fs)
    • classifyType

      private final int classifyType(TypeImpl ti)
      classify the type, without distinguishng list types
      Parameters:
      ti - the type
      Returns:
      the classification
    • enqueueOutOfTypeSystemData

      private void enqueueOutOfTypeSystemData(OutOfTypeSystemData aData)
    • serializeOutOfTypeSystemData

      private void serializeOutOfTypeSystemData(OutOfTypeSystemData aData) throws SAXException
      Throws:
      SAXException