Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## util
Class HNSUtils

    java.lang.Object
      util.HNSUtils

    public class HNSUtils

extends java.lang.Object

Static support methods for manual HamNoSys/SiGML text processing.

Field Summary
`static java.lang.String` | `EOL` Unix end-of-line.
`static java.lang.String` | `GLOSS` SiGML attribute name: `sign_manual`.
`static java.lang.String` | `HAM_GEST_SIGN` SiGML tag name: `hamgestural_sign`.
`static java.lang.String` | `HNS_MANUAL` SiGML tag name: `hamnosys_manual`.
`static java.lang.String` | `HNS_SIGN` SiGML tag name: `hns_sign`.
`static java.lang.String` | `SIGML` SiGML tag name: `sigml`.
`static java.lang.String` | `SIGN_MANUAL` SiGML tag name: `sign_manual`.
`static java.lang.String` | `STD_ENCODING` "Standard" Unicode encoding: `utf-8` -- but note this is not actually standard on Mac OS X, MacRoman is.
`static java.lang.String` | `STD_XML_DECL` XML declaration with the standard encoding.

Constructor Summary
`HNSUtils()`

Method Summary
`static java.lang.String` | `ATTR_DEF(java.lang.String nm, java.lang.String val)` Returns the text for a simple XML attribute definition with an initial space, using the given name and value; "simple" here means that absolutely _no_ escaping is applied to the value.
`static byte[]` | `bytes(java.lang.String s)` Returns the byte sequence for the given string under the standard, that is, "utf-8", encoding.
`static byte[]` | `bytes(java.lang.String s, java.lang.String enc)` Returns the byte sequence for the given string under the given encoding.
`static java.lang.String[][]` | `cleanHamNameVecs(java.lang.String[][] hamnvs)` Cleans the given set of HamNoSys symbol name sequences, that is, removes invalid names, generating a message on the standard error stream for each one removed.
`static java.lang.String[]` | `cleanHNS8(java.lang.String[] hns8)` Cleans the given set of manual HamNoSys Unicode strings, that is, removes every character that is not a genuine HamNoSys symbol, generating a message on the standard error stream for each one removed.
`static java.lang.String[]` | `cleanHNSU(java.lang.String[] hnsu)` Cleans the given set of manual HamNoSys Unicode strings, that is, removes every character that is not a genuine HamNoSys symbol, generating a message on the standard error stream for each one removed.
`static java.lang.String` | `EL_EMPTY(java.lang.String eltype)` Returns an empty XML element tag for the given element type.
`static java.lang.String` | `EL_EMPTY(java.lang.String eltype, java.lang.String anm, java.lang.String aval)` Returns an empty XML element tag for the given element type with an attribute with the given name and value.
`static java.lang.String` | `EL_END(java.lang.String eltype)` Returns an XML end tag for the given element type.
`static java.lang.String` | `EL_START(java.lang.String eltype)` Returns an XML start tag for the given element type.
`static java.lang.String` | `EL_START(java.lang.String eltype, java.lang.String anm, java.lang.String aval)` Returns an XML start tag for the given element type with an attribute with the given name and value.
`static java.lang.String` | `EL_START(java.lang.String eltype, java.lang.String anm0, java.lang.String aval0, java.lang.String anm1, java.lang.String aval1)` Returns an XML start tag for the given element type with a pair of attributes with the given names and values.
`static java.lang.String[]` | `EL_WRAP(java.lang.String eltype, java.lang.String[] body)` Returns XML lines in which the given element body is wrapped by an element with the given type.
`static java.lang.String[]` | `EL_WRAP(java.lang.String eltype, java.lang.String anm, java.lang.String aval, java.lang.String[] body)` Returns XML lines in which the given element body is wrapped by an element with the given type and an attribute with the given name and value.
`static java.lang.String[]` | `EL_WRAP(java.lang.String eltype, java.lang.String anm0, java.lang.String aval0, java.lang.String anm1, java.lang.String aval1, java.lang.String[] body)` Returns XML lines in which the given element body is wrapped by an element with the given type and a pair of attributes with the given names and values.
`static java.lang.String` | `elNameFromEmptyEl(java.lang.String eel)` Extracts and returns the element name from the given string if it is an empty XML element string, or returns `null` otherwise.
`static java.lang.String[][]` | `elSeqFromSimpleXML(java.lang.String[] els, java.lang.String[] xlines)` Extracts from the given sequence of simple XML lines the subsegments representing all non-nested occurrences of elements in the given list.
`static java.lang.String[][]` | `elSeqFromSimpleXML(java.lang.String el, java.lang.String[] xlines)` Extracts from the given sequence of simple XML lines the subsegments representing all occurrences of the given element.
`static java.io.PrintStream` | `filePrintStream(java.io.File dir, java.lang.String fname)` Returns a print stream, using the standard encoding (UTF-8), for the given file within the given directory.
`static java.io.PrintStream` | `filePrintStream(java.io.File dir, java.lang.String fname, java.lang.String enc)` Returns a print stream, using the given encoding, for the given file within the given directory.
`static java.io.PrintStream` | `filePrintStream(java.lang.String dir, java.lang.String fname)` Returns a print stream, using the standard encoding (UTF-8), for the given file within the given directory.
`static java.io.PrintStream` | `filePrintStream(java.lang.String dir, java.lang.String fname, java.lang.String enc)` Returns a print stream, using the given encoding, for the given file within the given directory.
`static java.io.BufferedReader` | `getBufReader(java.io.File path)` Returns a buffered reader, using the standard encoding (UTF-8), for the given file path.
`static java.io.BufferedReader` | `getBufReader(java.io.File dir, java.lang.String file)` Returns a buffered reader, using the standard encoding (UTF-8), for the given file within the given directory.
`static java.io.BufferedReader` | `getBufReader(java.lang.String path)` Returns a buffered reader, using the standard encoding (UTF-8), for the given file path.
`static java.io.BufferedReader` | `getStdBufReader()` Returns a buffered reader, using the standard encoding (UTF-8), for the standard input.
`static java.lang.String[]` | `glossesFromHNSItems(java.lang.String[] hnsitems)` Extracts the gloss names from the given sequence of HNS items, each item assumed to consist of a manual HamNoSys string optionally followed by whitespace and the gloss name.
`static java.lang.String[]` | `glossesFromSigns(java.lang.String[][] signs)` Extracts the gloss names from the given sequence of SiGML `<hns_sign>` or `<hamgestural_sign>` texts, assuming the gloss definition appears in the first line of text.
`static java.lang.String` | `glossForItem(int ix, int max)` Returns a (gloss) name of the form `item_ix` where `ix` is the given index value, made to occupy a field whose width is that required to accommodate the given maximum value.
`static java.lang.String` | `glossForItem(java.lang.String gstr, int ix, int max)` Simply returns the given gloss name if it is non-null; otherwise, constructs a new gloss name of the form `item_ix` where `ix` is the given index value, made to occupy a field whose width is that required to accommodate the given maximum value.
`static java.lang.String[]` | `hns8FromHNSNameVecs(java.lang.String[][] hnsnv)` Converts the given sequences of HamNoSys symbol names to the corresponding classic (8-bit) manual HamNoSys strings.
`static java.lang.String[]` | `hns8FromHNSU(java.lang.String[] hnsu)` Converts the given manual HamNoSys (Unicode) strings to the corresponding classic (8-bit) manual HamNoSys strings.
`static java.lang.String[]` | `hns8FromSymHNSItems(java.lang.String[] symhnsi)` Extracts the sequence of strings of classic 8-bit manual HamNoSys codes from the given sequence of HNS items, assuming that each item starts with such a string.
`static java.lang.String[]` | `hns8ItemsFromSymHNSItems(java.lang.String[] symhnsi)` Extracts strings of classic 8-bit manual HamNoSys codes from the given sequence of HNS items, assuming that each item starts with such a string.
`static java.lang.String[]` | `hnsFromHNSItems(java.lang.String[] hnsitems)` Extracts the manual HamNoSys strings from the given sequence of HNS items, each item being assumed to start with such a string.
`static java.lang.String[]` | `hnsManElFromHNSNameVec(java.lang.String[] hnsnv)` Returns the lines of the `<hamnosys_manual>` SiGML element for the given sequence of manual HamNoSys symbol names.
`static java.lang.String[][]` | `hnsMansFromHNSSigns(java.lang.String[][] hsigns)` Extracts the `<hamnosys_manual>` elements from the given sequence of `<hns_sign>` SiGML elements.
`static java.lang.String[][]` | `hnsNameVecsFromHNS8(java.lang.String[] hns8)` Converts the given classic (8-bit) manual HamNoSys strings to the corresponding sequences of HamNoSys symbol names.
`static java.lang.String[][]` | `hnsNameVecsFromHNSMans(java.lang.String[][] hmans)` Constructs and returns a sequence of HNS symbol names for each of the given `<hamnosys_manual>` SiGML element texts.
`static java.lang.String[][]` | `hnsNameVecsFromHNSU(java.lang.String[] hnsu)`
`static java.lang.String[][]` | `hnsNameVecsFromSymHNS(java.lang.String[] symhns)` Converts the given symbolic (manual) HamNoSys strings to sequences of HamNoSys symbol names, assuming that adjacent pairs of HNS names in the strings are separated by the comma character.
`static java.lang.String[][]` | `hnsNameVecsFromSymHNS(java.lang.String[] symhns, java.lang.String sep)` Converts the given symbolic (manual) HNS strings to sequences of HamNoSys symbol names, assuming that adjacent pairs of HNS names in the strings are separated by the given string.
`static java.lang.String[]` | `hnsSignFromHNSNameVec(java.lang.String[] hnsnv, java.lang.String gloss)` Returns the lines of the `<hns_sign>` SiGML element for the given sequence of manual HamNoSys symbol names, using the given gloss name.
`static java.lang.String[]` | `hnsuFromHNS8(java.lang.String[] hns8)` Converts the given classic (8-bit) manual HamNoSys strings to the corresponding HamNoSys (Unicode) strings.
`static java.lang.String[]` | `hnsuFromHNSMans(java.lang.String[][] hmans)` Returns a sequence of manual HNS (Unicode) strings, one for each of the given sequence of SiGML `<hamnosys_manual>` element texts (each text being presented as a sequence of lines).
`static java.lang.String[]` | `hnsuFromHNSNameVecs(java.lang.String[][] hnsnv)` Converts the given sequences of HamNoSys symbol names to the corresponding manual HamNoSys (Unicode) strings.
`static java.lang.String[]` | `hnsuFromSymHNSItems(java.lang.String[] symhnsi)` Extracts the sequence of manual HamNoSys (Unicode) strings from the given sequence of HNS items, assuming that each item starts with such a string.
`static java.lang.String[]` | `hnsuItemsFromHNS8Items(java.lang.String[] hns8i)` Converts the given sequence of manual HamNoSys items from the classic (8-bit) HNS encoding to HNS (Unicode), assuming that each item starts with a string of classic manual HNS octet values.
`static java.lang.String[]` | `hnsuItemsFromHSiGML(java.lang.String[] hslines)` Returns a sequence of HNS (Unicode) items, one for each `<hns_sign>` element in the given SiGML text (presented as a sequence of lines).
`static java.lang.String[]` | `hnsuItemsFromSymHNSItems(java.lang.String[] symhnsi)` Extracts the (manual) HamNoSys (Unicode) strings from the given sequence of HNS items, assuming that each item starts with such a string.
`static java.lang.String` | `INDENT(int in)` Returns an indent string with the given number of steps, at 2 spaces per step.
`static java.lang.String[]` | `indentXML(java.lang.String[] lines)` Adjusts the lines of the given XML line sequence by applying the appropriate indentation to each one, returning the given (albeit now modified) sequence itself.
`static java.lang.String` | `join(java.util.List<java.lang.String> sseq, java.lang.String sep)` Merges the given sequence of lines into a single multi-line string (with one EOL character at the end of each line).
`static java.lang.String` | `join(java.util.List<java.lang.String> sseq, java.lang.String sep, boolean treat_sep_as_term)` Merges the given sequence of strings using the given separator string.
`static java.lang.String` | `join(java.lang.String[] sseq, java.lang.String sep)` Merges the given sequence of strings using the given separator string.
`static java.lang.String` | `join(java.lang.String[] sseq, java.lang.String sep, boolean treat_sep_as_term)` Joins the given string sequence into a single string using the given separator string, treating that separator as a terminator -- thus appending it to the final item if any -- as specified.
`static java.lang.String` | `joinLines(java.util.List<java.lang.String> items)` Merges the given sequence of lines into a single multi-line string (with one EOL character at the end of each line).
`static java.lang.String` | `joinLines(java.lang.String[] lines)` Merges the given sequence of lines into a single multi-line string (with one EOL character at the end of each line).
`static void` | `main(java.lang.String[] args)`
`static java.lang.String[]` | `merge(java.lang.String[][] slists)` Returns a single new string array obtained by merging the given list of string arrays.
`static int` | `nDigits(int n)` Returns the number of (decimal) digits needed to print (non-negative) n.
`static java.lang.String` | `numStr(int num, int max)` Returns the decimal string for the given (non-negative) number with enough leading zeros to make the string length match that required for the given (non-negative) maximum value.
`static java.lang.String[]` | `prefix(java.lang.String pfx, java.lang.String[] body)` Returns an array of strings in which the given body array is prefixed with the given initial item.
`static void` | `print(java.lang.String[] lines, java.io.PrintWriter prntr)` Prints the given line sequence to the given printer.
`static java.lang.String[]` | `readLines(java.io.BufferedReader brdr)` Reads and returns the lines from the given buffered reader.
`static java.lang.String[]` | `sigmlFromHNS8Items(java.lang.String[] hns8i)` Returns the lines of the SiGML text for the given sequence of classic (8-bit) manual HamNoSys items.
`static java.lang.String[]` | `sigmlFromHNSUItems(java.lang.String[] hnsui)` Returns the lines of the SiGML text for the given sequence of manual HamNoSys (Unicode) items.
`static java.lang.String[][]` | `signDocsFromSigns(java.lang.String[][] signs)` Converts the given SiGML sign element (`<hns_sign>` and `<hamgestural_sign>`) texts into SiGML documents, one per sign.
`static java.lang.String[][]` | `signsFromSiGMLDoc(java.lang.String[] sigml)` Breaks the given SiGML document text into its individual sign element (`<hns_sign>` and `<hamgestural_sign>`) texts.
`static java.lang.String[]` | `singleElFromSimpleXML(java.lang.String el, java.lang.String[] xlines)` Extracts from the given sequence of simple XML lines the subsegment representing the first occurrence of the given element.
`static java.lang.String[]` | `symHNSFromHNSNameVecs(java.lang.String[][] hnsnv)` Converts the given sequences of (manual) HamNoSys symbol names to symbolic HNS strings, using the comma character to separate the symbolic names in each string.
`static java.lang.String[]` | `symHNSFromHNSNameVecs(java.lang.String[][] hnsnv, java.lang.String sep)` Converts the given sequences of (manual) HamNoSys symbol names to symbolic HNS strings, using the given string to separate the symbolic names in each string.
`static java.lang.String[]` | `symHNSFromHNSUItems(java.lang.String[] hnsui)` Returns the sequence of symbolic (manual) HamNoSys strings corresponding to the given sequence of HNS (Unicode) items.
`static java.lang.String[]` | `symHNSItemsFromHNSUItems(java.lang.String[] hnsui)` Extracts the symbolic (manual) HamNoSys strings from the given sequence of HNS items, assuming that each item starts with such a string.
`static java.lang.String[]` | `tailsFromHNSItems(java.lang.String[] hnsitems)` Extracts the tails from the given sequence of HNS items, the tail of an item being all text after the initial manual HamNoSys string.
`static void` | `toStdOut(java.lang.String[] lines)` Prints the given line sequence to standard output under the standard (i.e.
`static void` | `toStream(java.lang.String[] lines, java.io.PrintStream outs)` Prints the given line sequence to the given print stream under the standard (i.e.
`static java.lang.String[]` | `trim(java.lang.String[] sseq)` Trims each string in the given sequence, returning the (modified) sequence itself.
`static java.lang.String` | `UN_EL_END(java.lang.String elendtag)` Returns the element name from the given XML end tag, assumed to have been created by `EL_END(java.lang.String)`.
`static java.lang.String[]` | `wrap(java.lang.String beg, java.lang.String[] body, java.lang.String end)` Returns an array of strings in which the given body array is wrapped with the given initial and final items.
`static java.lang.String` | `XML_DECL(java.lang.String enc)` Returns an XML declaration string with the given encoding.
`static java.lang.String[]` | `zip(java.lang.String[] ss0, java.lang.String[] ss1)` Returns the string array obtained by concatenating pairs of corresponding items in the two given arrays, which are assumed to be of the same length.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EOL

    public static final java.lang.String EOL

  Unix end-of-line.

  See Also:
    Constant Field Values

### SIGML

    public static final java.lang.String SIGML

  SiGML tag name: `sigml`.

  See Also:
    Constant Field Values

### HNS_SIGN

    public static final java.lang.String HNS_SIGN

  SiGML tag name: `hns_sign`.

  See Also:
    Constant Field Values

### HNS_MANUAL

    public static final java.lang.String HNS_MANUAL

  SiGML tag name: `hamnosys_manual`.

  See Also:
    Constant Field Values

### HAM_GEST_SIGN

    public static final java.lang.String HAM_GEST_SIGN

  SiGML tag name: `hamgestural_sign`.

  See Also:
    Constant Field Values

### SIGN_MANUAL

    public static final java.lang.String SIGN_MANUAL

  SiGML tag name: `sign_manual`.

  See Also:
    Constant Field Values

### GLOSS

    public static final java.lang.String GLOSS

  SiGML attribute name: `sign_manual`.

  See Also:
    Constant Field Values

### STD_ENCODING

    public static final java.lang.String STD_ENCODING

  "Standard" Unicode encoding: `utf-8` -- but note this is not actually standard on Mac OS X, MacRoman is.

  See Also:
    Constant Field Values

### STD_XML_DECL

    public static final java.lang.String STD_XML_DECL

  XML declaration with the standard encoding.

Constructor Detail

### HNSUtils

    public HNSUtils()

Method Detail

### signDocsFromSigns

    public static java.lang.String[][] signDocsFromSigns(java.lang.String[][] signs)

  Converts the given SiGML sign element (`<hns_sign>` and `<hamgestural_sign>`) texts into SiGML documents, one per sign.

### signsFromSiGMLDoc

    public static java.lang.String[][] signsFromSiGMLDoc(java.lang.String[] sigml)

  Breaks the given SiGML document text into its individual sign element (`<hns_sign>` and `<hamgestural_sign>`) texts.

### sigmlFromHNSUItems

    public static java.lang.String[] sigmlFromHNSUItems(java.lang.String[] hnsui)

  Returns the lines of the SiGML text for the given sequence of manual HamNoSys (Unicode) items. Each item is assumed to consist of a manual HNS (Unicode) string, optionally followed by whitespace and a gloss name.

### sigmlFromHNS8Items

    public static java.lang.String[] sigmlFromHNS8Items(java.lang.String[] hns8i)

  Returns the lines of the SiGML text for the given sequence of classic (8-bit) manual HamNoSys items. Each item is assumed to consist of a string of classic manual HNS octet values, optionally followed by whitespace and a gloss name.

### hnsuItemsFromHNS8Items

    public static java.lang.String[] hnsuItemsFromHNS8Items(java.lang.String[] hns8i)

  Converts the given sequence of manual HamNoSys items from the classic (8-bit) HNS encoding to HNS (Unicode), assuming that each item starts with a string of classic manual HNS octet values.

### hns8ItemsFromSymHNSItems

    public static java.lang.String[] hns8ItemsFromSymHNSItems(java.lang.String[] symhnsi)

  Extracts strings of classic 8-bit manual HamNoSys codes from the given sequence of HNS items, assuming that each item starts with such a string.

### hns8FromSymHNSItems

    public static java.lang.String[] hns8FromSymHNSItems(java.lang.String[] symhnsi)

  Extracts the sequence of strings of classic 8-bit manual HamNoSys codes from the given sequence of HNS items, assuming that each item starts with such a string.

### symHNSItemsFromHNSUItems

    public static java.lang.String[] symHNSItemsFromHNSUItems(java.lang.String[] hnsui)

  Extracts the symbolic (manual) HamNoSys strings from the given sequence of HNS items, assuming that each item starts with such a string.

### hnsuItemsFromSymHNSItems

    public static java.lang.String[] hnsuItemsFromSymHNSItems(java.lang.String[] symhnsi)

  Extracts the (manual) HamNoSys (Unicode) strings from the given sequence of HNS items, assuming that each item starts with such a string.

### symHNSFromHNSUItems

    public static java.lang.String[] symHNSFromHNSUItems(java.lang.String[] hnsui)

  Returns the sequence of symbolic (manual) HamNoSys strings corresponding to the given sequence of HNS (Unicode) items. Each item is assumed to start with a manual HNS (Unicode) string, and the corresponding result string consists of the corresponding sequence of HNS symbol names separated by commas.

### hnsuFromSymHNSItems

    public static java.lang.String[] hnsuFromSymHNSItems(java.lang.String[] symhnsi)

  Extracts the sequence of manual HamNoSys (Unicode) strings from the given sequence of HNS items, assuming that each item starts with such a string.

### hnsNameVecsFromSymHNS

    public static java.lang.String[][] hnsNameVecsFromSymHNS(java.lang.String[] symhns)

  Converts the given symbolic (manual) HamNoSys strings to sequences of HamNoSys symbol names, assuming that adjacent pairs of HNS names in the strings are separated by the comma character.

### hnsNameVecsFromSymHNS

    public static java.lang.String[][] hnsNameVecsFromSymHNS(java.lang.String[] symhns,
                                                             java.lang.String sep)

  Converts the given symbolic (manual) HNS strings to sequences of HamNoSys symbol names, assuming that adjacent pairs of HNS names in the strings are separated by the given string.

### symHNSFromHNSNameVecs

    public static java.lang.String[] symHNSFromHNSNameVecs(java.lang.String[][] hnsnv)

  Converts the given sequences of (manual) HamNoSys symbol names to symbolic HNS strings, using the comma character to separate the symbolic names in each string.

### symHNSFromHNSNameVecs

    public static java.lang.String[] symHNSFromHNSNameVecs(java.lang.String[][] hnsnv,
                                                           java.lang.String sep)

  Converts the given sequences of (manual) HamNoSys symbol names to symbolic HNS strings, using the given string to separate the symbolic names in each string.

### hnsuFromHNSNameVecs

    public static java.lang.String[] hnsuFromHNSNameVecs(java.lang.String[][] hnsnv)

  Converts the given sequences of HamNoSys symbol names to the corresponding manual HamNoSys (Unicode) strings.

### hns8FromHNSNameVecs

    public static java.lang.String[] hns8FromHNSNameVecs(java.lang.String[][] hnsnv)

  Converts the given sequences of HamNoSys symbol names to the corresponding classic (8-bit) manual HamNoSys strings. So, conceptually, each string in the result contains a sequence not of genuine (low-valued) Unicode character codes, but of classic HamNoSys octet values.

### hnsNameVecsFromHNSU

    public static java.lang.String[][] hnsNameVecsFromHNSU(java.lang.String[] hnsu)

### hnsNameVecsFromHNS8

    public static java.lang.String[][] hnsNameVecsFromHNS8(java.lang.String[] hns8)

  Converts the given classic (8-bit) manual HamNoSys strings to the corresponding sequences of HamNoSys symbol names. So, conceptually, each input string contains a sequence not of genuine (low-valued) Unicode character codes, but of classic HamNoSys octet values.

### hns8FromHNSU

    public static java.lang.String[] hns8FromHNSU(java.lang.String[] hnsu)

  Converts the given manual HamNoSys (Unicode) strings to the corresponding classic (8-bit) manual HamNoSys strings. So, conceptually, each string in the result contains a sequence not of genuine (low-valued) Unicode character codes, but of classic HamNoSys octet values.

### cleanHNS8

    public static java.lang.String[] cleanHNS8(java.lang.String[] hns8)

  Cleans the given set of manual HamNoSys Unicode strings, that is, removes every character that is not a genuine HamNoSys symbol, generating a message on the standard error stream for each one removed.

### cleanHNSU

    public static java.lang.String[] cleanHNSU(java.lang.String[] hnsu)

  Cleans the given set of manual HamNoSys Unicode strings, that is, removes every character that is not a genuine HamNoSys symbol, generating a message on the standard error stream for each one removed.

### cleanHamNameVecs

    public static java.lang.String[][] cleanHamNameVecs(java.lang.String[][] hamnvs)

  Cleans the given set of HamNoSys symbol name sequences, that is, removes invalid names, generating a message on the standard error stream for each one removed.

### hnsuFromHNS8

    public static java.lang.String[] hnsuFromHNS8(java.lang.String[] hns8)

  Converts the given classic (8-bit) manual HamNoSys strings to the corresponding HamNoSys (Unicode) strings. So, conceptually, each input string contains a sequence not of genuine (low-valued) Unicode character codes, but of classic HamNoSys octet values.

### hnsFromHNSItems

    public static java.lang.String[] hnsFromHNSItems(java.lang.String[] hnsitems)

  Extracts the manual HamNoSys strings from the given sequence of HNS items, each item being assumed to start with such a string.

### tailsFromHNSItems

    public static java.lang.String[] tailsFromHNSItems(java.lang.String[] hnsitems)

  Extracts the tails from the given sequence of HNS items, the tail of an item being all text after the initial manual HamNoSys string.

### glossesFromHNSItems

    public static java.lang.String[] glossesFromHNSItems(java.lang.String[] hnsitems)

  Extracts the gloss names from the given sequence of HNS items, each item assumed to consist of a manual HamNoSys string optionally followed by whitespace and the gloss name. If item n consists solely of the HNS string, then a gloss name of the form `item_n` is used instead.

### hnsSignFromHNSNameVec

    public static java.lang.String[] hnsSignFromHNSNameVec(java.lang.String[] hnsnv,
                                                           java.lang.String gloss)

  Returns the lines of the `<hns_sign>` SiGML element for the given sequence of manual HamNoSys symbol names, using the given gloss name.

### hnsManElFromHNSNameVec

    public static java.lang.String[] hnsManElFromHNSNameVec(java.lang.String[] hnsnv)

  Returns the lines of the `<hamnosys_manual>` SiGML element for the given sequence of manual HamNoSys symbol names.

### hnsuItemsFromHSiGML

    public static java.lang.String[] hnsuItemsFromHSiGML(java.lang.String[] hslines)

  Returns a sequence of HNS (Unicode) items, one for each `<hns_sign>` element in the given SiGML text (presented as a sequence of lines). Each item consists of the manual HNS (Unicode) string for the sign and its gloss name, separated by a single tab `\t` character.

### hnsuFromHNSMans

    public static java.lang.String[] hnsuFromHNSMans(java.lang.String[][] hmans)

  Returns a sequence of manual HNS (Unicode) strings, one for each of the given sequence of SiGML `<hamnosys_manual>` element texts (each text being presented as a sequence of lines).

### hnsNameVecsFromHNSMans

    public static java.lang.String[][] hnsNameVecsFromHNSMans(java.lang.String[][] hmans)

  Constructs and returns a sequence of HNS symbol names for each of the given `<hamnosys_manual>` SiGML element texts.

### glossesFromSigns

    public static java.lang.String[] glossesFromSigns(java.lang.String[][] signs)

  Extracts the gloss names from the given sequence of SiGML `<hns_sign>` or `<hamgestural_sign>` texts, assuming the gloss definition appears in the first line of text. A gloss name of the form `item_n` is provided if the n'th sign fails to conform to this assumption.

### hnsMansFromHNSSigns

    public static java.lang.String[][] hnsMansFromHNSSigns(java.lang.String[][] hsigns)

  Extracts the `<hamnosys_manual>` elements from the given sequence of `<hns_sign>` SiGML elements. CAVEAT EMPTOR: The SiGML input is assumed to be "simple", i.e. it has no troublesome things like nesting of sign elements, nor element occurrences in comments, etc.

### glossForItem

    public static java.lang.String glossForItem(int ix,
                                                int max)

  Returns a (gloss) name of the form `item_ix` where `ix` is the given index value, made to occupy a field whose width is that required to accommodate the given maximum value.

### glossForItem

    public static java.lang.String glossForItem(java.lang.String gstr,
                                                int ix,
                                                int max)

  Simply returns the given gloss name if it is non-null; otherwise, constructs a new gloss name of the form `item_ix` where `ix` is the given index value, made to occupy a field whose width is that required to accommodate the given maximum value.

### elSeqFromSimpleXML

    public static java.lang.String[][] elSeqFromSimpleXML(java.lang.String el,
                                                          java.lang.String[] xlines)

  Extracts from the given sequence of simple XML lines the subsegments representing all occurrences of the given element. CAVEAT EMPTOR: "Simple XML" means no troublesome things like nested occurrences of the required element, nor occurrences in comments, etc.

### main

    public static void main(java.lang.String[] args)

### elSeqFromSimpleXML

    public static java.lang.String[][] elSeqFromSimpleXML(java.lang.String[] els,
                                                          java.lang.String[] xlines)

  Extracts from the given sequence of simple XML lines the subsegments representing all non-nested occurrences of elements in the given list. CAVEAT EMPTOR: "Simple XML" means that there's at most one tag per line, and no troublesome things like occurrences of elements embedded in comments, etc.

### singleElFromSimpleXML

    public static java.lang.String[] singleElFromSimpleXML(java.lang.String el,
                                                           java.lang.String[] xlines)

  Extracts from the given sequence of simple XML lines the subsegment representing the first occurrence of the given element. "Simple XML" means no troublesome things like nested occurrences of the required element, nor occurrences in comments, etc.

### readLines

    public static java.lang.String[] readLines(java.io.BufferedReader brdr)
                                        throws java.io.IOException

  Reads and returns the lines from the given buffered reader.

  Throws:
    `java.io.IOException`

### getBufReader

    public static java.io.BufferedReader getBufReader(java.io.File dir,
                                                      java.lang.String file)

  Returns a buffered reader, using the standard encoding (UTF-8), for the given file within the given directory.

### getBufReader

    public static java.io.BufferedReader getBufReader(java.lang.String path)

  Returns a buffered reader, using the standard encoding (UTF-8), for the given file path.

### getBufReader

    public static java.io.BufferedReader getBufReader(java.io.File path)

  Returns a buffered reader, using the standard encoding (UTF-8), for the given file path.

### getStdBufReader

    public static java.io.BufferedReader getStdBufReader()

  Returns a buffered reader, using the standard encoding (UTF-8), for the standard input.

### elNameFromEmptyEl

    public static java.lang.String elNameFromEmptyEl(java.lang.String eel)

  Extracts and returns the element name from the given string if it is an empty XML element string, or returns `null` otherwise.

### EL_WRAP

    public static final java.lang.String[] EL_WRAP(java.lang.String eltype,
                                                   java.lang.String anm0,
                                                   java.lang.String aval0,
                                                   java.lang.String anm1,
                                                   java.lang.String aval1,
                                                   java.lang.String[] body)

  Returns XML lines in which the given element body is wrapped by an element with the given type and a pair of attributes with the given names and values.

### EL_WRAP

    public static final java.lang.String[] EL_WRAP(java.lang.String eltype,
                                                   java.lang.String anm,
                                                   java.lang.String aval,
                                                   java.lang.String[] body)

  Returns XML lines in which the given element body is wrapped by an element with the given type and an attribute with the given name and value.

### EL_WRAP

    public static final java.lang.String[] EL_WRAP(java.lang.String eltype,
                                                   java.lang.String[] body)

  Returns XML lines in which the given element body is wrapped by an element with the given type.

### XML_DECL

    public static final java.lang.String XML_DECL(java.lang.String enc)

  Returns an XML declaration string with the given encoding.

### EL_START

    public static final java.lang.String EL_START(java.lang.String eltype)

  Returns an XML start tag for the given element type.

### EL_START

    public static final java.lang.String EL_START(java.lang.String eltype,
                                                  java.lang.String anm0,
                                                  java.lang.String aval0,
                                                  java.lang.String anm1,
                                                  java.lang.String aval1)

  Returns an XML start tag for the given element type with a pair of attributes with the given names and values.

### EL_START

    public static final java.lang.String EL_START(java.lang.String eltype,
                                                  java.lang.String anm,
                                                  java.lang.String aval)

  Returns an XML start tag for the given element type with an attribute with the given name and value.

### EL_END

    public static final java.lang.String EL_END(java.lang.String eltype)

  Returns an XML end tag for the given element type.

### UN_EL_END

    public static final java.lang.String UN_EL_END(java.lang.String elendtag)

  Returns the element name from the given XML end tag, assumed to have been created by `EL_END(java.lang.String)`.

### EL_EMPTY

    public static final java.lang.String EL_EMPTY(java.lang.String eltype)

  Returns an empty XML element tag for the given element type.

### EL_EMPTY

    public static final java.lang.String EL_EMPTY(java.lang.String eltype,
                                                  java.lang.String anm,
                                                  java.lang.String aval)

  Returns an empty XML element tag for the given element type with an attribute with the given name and value.

### ATTR_DEF

    public static final java.lang.String ATTR_DEF(java.lang.String nm,
                                                  java.lang.String val)

  Returns the text for a simple XML attribute definition with an initial space, using the given name and value; "simple" here means that absolutely _no_ escaping is applied to the value.

### print

    public static void print(java.lang.String[] lines,
                             java.io.PrintWriter prntr)

  Prints the given line sequence to the given printer.

### toStdOut

    public static void toStdOut(java.lang.String[] lines)

  Prints the given line sequence to standard output under the standard (i.e. utf-8) encoding.

### toStream

    public static void toStream(java.lang.String[] lines,
                                java.io.PrintStream outs)

  Prints the given line sequence to the given print stream under the standard (i.e. utf-8) encoding.

### bytes

    public static byte[] bytes(java.lang.String s)

  Returns the byte sequence for the given string under the standard, that is, "utf-8", encoding.

### bytes

    public static byte[] bytes(java.lang.String s,
                               java.lang.String enc)

  Returns the byte sequence for the given string under the given encoding.

### filePrintStream

    public static java.io.PrintStream filePrintStream(java.lang.String dir,
                                                      java.lang.String fname)
                                               throws java.io.IOException

  Returns a print stream, using the standard encoding (UTF-8), for the given file within the given directory.

  Throws:
    `java.io.IOException`

### filePrintStream

    public static java.io.PrintStream filePrintStream(java.lang.String dir,
                                                      java.lang.String fname,
                                                      java.lang.String enc)
                                               throws java.io.IOException

  Returns a print stream, using the given encoding, for the given file within the given directory.

  Throws:
    `java.io.IOException`

### filePrintStream

    public static java.io.PrintStream filePrintStream(java.io.File dir,
                                                      java.lang.String fname)
                                               throws java.io.IOException

  Returns a print stream, using the standard encoding (UTF-8), for the given file within the given directory.

  Throws:
    `java.io.IOException`

### filePrintStream

    public static java.io.PrintStream filePrintStream(java.io.File dir,
                                                      java.lang.String fname,
                                                      java.lang.String enc)
                                               throws java.io.IOException

  Returns a print stream, using the given encoding, for the given file within the given directory.

  Throws:
    `java.io.IOException`

### wrap

    public static java.lang.String[] wrap(java.lang.String beg,
                                          java.lang.String[] body,
                                          java.lang.String end)

  Returns an array of strings in which the given body array is wrapped with the given initial and final items.

### prefix

    public static java.lang.String[] prefix(java.lang.String pfx,
                                            java.lang.String[] body)

  Returns an array of strings in which the given body array is prefixed with the given initial item.

### INDENT

    public static final java.lang.String INDENT(int in)

  Returns an indent string with the given number of steps, at 2 spaces per step.

### indentXML

    public static java.lang.String[] indentXML(java.lang.String[] lines)

  Adjusts the lines of the given XML line sequence by applying the appropriate indentation to each one, returning the given (albeit now modified) sequence itself. Assumes the XML is all tags, one tag per line. Cheap 'n' cheerful, although with luck it will handle comments and PIs.

### zip

    public static java.lang.String[] zip(java.lang.String[] ss0,
                                         java.lang.String[] ss1)

  Returns the string array obtained by concatenating pairs of corresponding items in the two given arrays, which are assumed to be of the same length.

### merge

    public static java.lang.String[] merge(java.lang.String[][] slists)

  Returns a single new string array obtained by merging the given list of string arrays.

### joinLines

    public static java.lang.String joinLines(java.lang.String[] lines)

  Merges the given sequence of lines into a single multi-line string (with one EOL character at the end of each line).

### join

    public static java.lang.String join(java.lang.String[] sseq,
                                        java.lang.String sep)

  Merges the given sequence of strings using the given separator string.

### join

    public static java.lang.String join(java.lang.String[] sseq,
                                        java.lang.String sep,
                                        boolean treat_sep_as_term)

  Joins the given string sequence into a single string using the given separator string, treating that separator as a terminator -- thus appending it to the final item if any -- as specified.

### joinLines

    public static java.lang.String joinLines(java.util.List<java.lang.String> items)

  Merges the given sequence of lines into a single multi-line string (with one EOL character at the end of each line).

### join

    public static java.lang.String join(java.util.List<java.lang.String> sseq,
                                        java.lang.String sep)

  Merges the given sequence of lines into a single multi-line string (with one EOL character at the end of each line).

### join

    public static java.lang.String join(java.util.List<java.lang.String> sseq,
                                        java.lang.String sep,
                                        boolean treat_sep_as_term)

  Merges the given sequence of strings using the given separator string.

### trim

    public static java.lang.String[] trim(java.lang.String[] sseq)

  Trims each string in the given sequence, returning the (modified) sequence itself.

### numStr

    public static java.lang.String numStr(int num,
                                          int max)

  Returns the decimal string for the given (non-negative) number with enough leading zeros to make the string length match that required for the given (non-negative) maximum value.

### nDigits

    public static int nDigits(int n)

  Returns the number of (decimal) digits needed to print (non-negative) n.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD