textbender.a.u.encoding
Class Encoder

java.lang.Object
  extended by Encoder

public final class Encoder
extends Object

A genetic encoder.


Constructor Summary
Encoder(Element gg, List<Element> gList, Replacer clipGeneReplacer, StringBuilder stringBuilder, UUIDStringifier uuidStringifier)
          Creates an Encoder for a document.
 
Method Summary
static Document encoded(InputStream in, TransformerFactory transformerFactory, DOMErrorHandler errorHandler)
          Returns a Recombinant XHTML document read from an input stream, and then encoded.
 void encodeRecursively(Node node)
          Encodes the node and its descendants.
static boolean isMarginal(Element element)
          Answers whether the element is abutted with the left margin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Encoder

Encoder(Element gg,
        List<Element> gList,
        Replacer clipGeneReplacer,
        StringBuilder stringBuilder,
        UUIDStringifier uuidStringifier)
Creates an Encoder for a document.

Parameters:
gg - the 'g' list ('gg') element of the document
gList - live list of gene meta-data ('g') elements in 'gg' (e.g. backed by a NodeList)
clipGeneReplacer - to use
stringBuilder - string builder to use, overwriting its existing content
uuidStringifier - UUID stringifier to use
Method Detail

encoded

public static Document encoded(InputStream in,
                               TransformerFactory transformerFactory,
                               DOMErrorHandler errorHandler)
                        throws IOException,
                               LSException,
                               TextbenderException,
                               TransformerException
Returns a Recombinant XHTML document read from an input stream, and then encoded. Convenience method.

Parameters:
in - stream to read document from
transformerFactory - to use
errorHandler - to use
Returns:
document, suitable for passing to RecombinantXHTML.write
Throws:
IOException - from Replacer to the provided errorHandler
TextbenderException - if document not in recombinant form
TransformerException - from replaceRecursively, new Replacer
LSException

encodeRecursively

public void encodeRecursively(Node node)
                       throws TransformerException
Encodes the node and its descendants.

Throws:
TransformerException

isMarginal

public static boolean isMarginal(Element element)
Answers whether the element is abutted with the left margin.