Package org.gedcom4j.model

Examples of org.gedcom4j.model.StringTree


     */
    private static StringTree findLast(StringTree tree, int level) {
        if (tree.level == level) {
            return tree;
        }
        StringTree lastChild = tree.children.get(tree.children.size() - 1);
        if (lastChild.level == level) {
            return lastChild;
        }
        return findLast(lastChild, level);
    }
View Full Code Here


     * @throws IOException
     *             if there is a problem reading the data from the reader
     */
    private static StringTree makeStringTreeFromStream(BufferedInputStream bytes) throws IOException {
        List<String> lines = new GedcomFileReader(bytes).getLines();
        StringTree result = new StringTree();
        result.level = -1;
        try {
            for (int lineNum = 1; lineNum <= lines.size(); lineNum++) {
                String line = lines.get(lineNum - 1);
                line = leftTrim(line); // See issue 57
                LinePieces lp = new LinePieces(line);
                StringTree st = new StringTree();
                st.lineNum = lineNum;
                st.level = lp.level;
                st.id = lp.id;
                st.tag = lp.tag;
                st.value = lp.remainder;
                StringTree addTo = findLast(result, lp.level - 1);
                addTo.children.add(st);
                st.parent = addTo;
            }
        } finally {
            if (bytes != null) {
View Full Code Here

TOP

Related Classes of org.gedcom4j.model.StringTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.