Example usage for java.util Stack push

List of usage examples for java.util Stack push

Introduction

In this page you can find the example usage for java.util Stack push.

Prototype

public E push(E item) 

Source Link

Document

Pushes an item onto the top of this stack.

Usage

From source file:de.codesourcery.jasm16.compiler.Main.java

private int run(String[] args) throws Exception {
    final List<ICompilationUnit> units = new ArrayList<ICompilationUnit>();

    final Stack<String> arguments = new Stack<String>();
    for (String arg : args) {
        arguments.push(arg);
    }/*from   ww w . java  2 s.co m*/
    Collections.reverse(arguments);

    while (!arguments.isEmpty()) {
        final String arg = arguments.peek();
        if (arg.startsWith("-") || arg.startsWith("--")) {
            try {
                handleCommandlineOption(arg, arguments);
            } catch (NoSuchElementException e) {
                printError("Invalid command line, option " + arg + " lacks argument.");
                return 1;
            }
        } else {
            units.add(createCompilationUnit(arguments.pop()));
        }
    }

    if (verboseOutput) {
        printVersionInfo();
    }

    if (units.isEmpty()) {
        printError("No input files.");
        return 1;
    }

    setupCompiler(units);

    final ICompilationListener listener;
    if (printDebugStats || verboseOutput) {
        listener = new DebugCompilationListener(printDebugStats);
    } else {
        listener = new CompilationListener();
    }

    if (printSourceCode) {
        compiler.insertCompilerPhaseAfter(new CompilerPhase("format-code") {
            @Override
            protected void run(ICompilationUnit unit, ICompilationContext context) throws IOException {
                if (unit.getAST() != null) {
                    ASTUtils.visitInOrder(unit.getAST(), new FormattingVisitor(context));
                }
            };

        }, ICompilerPhase.PHASE_GENERATE_CODE);
    }

    // invoke compiler
    compiler.compile(units, listener);

    boolean hasErrors = false;
    for (ICompilationUnit unit : units) {
        if (unit.hasErrors()) {
            Misc.printCompilationErrors(unit, Misc.readSource(unit), printStackTraces);
            hasErrors = true;
        }
    }

    if (dumpObjectCode) {
        dumpObjectCode();
    }
    return hasErrors ? 1 : 0;
}

From source file:app.web.Application2ITCase.java

@Test
public void testApplication() {
    //goToHomepage();
    selenium.open(APPLICATION_HOMEPAGE);
    Stack<Action> actionStack = new Stack<Action>();
    actionStack.push(Action.open(APPLICATION_HOMEPAGE));
    testPageRecursively(actionStack);//from   w w  w . j a  v a  2s  .co m
}

From source file:org.ow2.proactive_grid_cloud_portal.cli.cmd.AbstractCommand.java

@SuppressWarnings("unchecked")
protected void handleError(String errorMessage, HttpResponseWrapper response,
        ApplicationContext currentContext) {
    String responseContent = StringUtility.responseAsString(response);
    Stack resultStack = resultStack(currentContext);
    ErrorView errorView = errorView(responseContent, currentContext);
    if (errorView != null) {
        resultStack.push(errorView);
    } else {//from   ww w. j  a  v a 2 s  .c om
        resultStack.push(responseContent);
    }
    if (errorView != null) {
        writeError(errorMessage, errorView, currentContext);
    } else {
        writeError(errorMessage, responseContent, currentContext);
    }
}

From source file:com.glaf.core.service.impl.MxQueryDefinitionServiceImpl.java

/**
 * ??,??//  w  w w  .ja v a 2 s. c  o m
 * 
 * @param queryId
 * @return
 */
public Stack<QueryDefinition> getQueryDefinitionStack(String queryId) {
    Stack<QueryDefinition> stack = new Stack<QueryDefinition>();
    QueryDefinition queryDefinition = this.getQueryDefinition(queryId);
    if (queryDefinition != null) {
        stack.push(queryDefinition);
        this.loadQueryDefinitionStack(stack, queryDefinition);
    }
    return stack;
}

From source file:org.netxilia.server.rest.HomeResource.java

/**
 * build the HTML tags for a tree like view
 * // w  w  w.j  av a2  s  .c  o m
 * @param foldersSheet
 * @param treeview
 * @throws NetxiliaBusinessException
 * @throws NetxiliaResourceException
 */
private DefaultMutableTreeNode buildWorkbookTree(IWorkbook workbook, ISheet foldersSheet,
        Set<SheetFullName> sheetNames) throws NetxiliaResourceException, NetxiliaBusinessException {
    DefaultMutableTreeNode workbookNode = new DefaultMutableTreeNode(
            new TreeViewData(workbook.getId().getKey(), workbook.getName(), "workbook"));

    Stack<DefaultMutableTreeNode> stockNodes = new Stack<DefaultMutableTreeNode>();
    stockNodes.push(workbookNode);

    Set<SheetFullName> alreadyInsertedSheets = new HashSet<SheetFullName>();
    if (foldersSheet != null) {
        Matrix<CellData> folderCells = foldersSheet.receiveCells(AreaReference.ALL).getNonBlocking();
        for (List<CellData> row : folderCells.getRows()) {
            int level = 0;
            String nodeName = null;
            for (CellData cell : row) {
                if (cell.getValue() != null) {
                    nodeName = cell.getValue().getStringValue();
                    if (nodeName != null && nodeName.length() > 0) {
                        level = cell.getReference().getColumnIndex();
                        break;
                    }
                }
            }

            if (nodeName == null) {
                // empty line - ignored
                continue;
            }

            // first level for folders is 1 (under the root node)
            level = level + 1;
            SheetFullName sheetName = new SheetFullName(workbook.getName(), nodeName);
            boolean isSheet = sheetNames.contains(sheetName);
            if (isSheet) {
                alreadyInsertedSheets.add(sheetName);
            }
            DefaultMutableTreeNode crt = new DefaultMutableTreeNode(new TreeViewData(sheetName.toString(),
                    sheetName.getSheetName(), isSheet ? "sheet" : "folder"));
            while (!stockNodes.empty()) {
                DefaultMutableTreeNode node = stockNodes.peek();
                if (level > node.getLevel()) {
                    // make sure is the direct child
                    node.add(crt);
                    break;
                }
                stockNodes.pop();
            }
            stockNodes.push(crt);
        }
    }
    // add the sheets not already added
    for (SheetFullName sheetName : sheetNames) {
        if (alreadyInsertedSheets.contains(sheetName)) {
            continue;
        }
        DefaultMutableTreeNode sheetNode = new DefaultMutableTreeNode(
                new TreeViewData(sheetName.toString(), sheetName.getSheetName(), "sheet"));
        workbookNode.add(sheetNode);
    }

    return workbookNode;
}

From source file:org.apache.hadoop.hdfs.server.namenode.WaitingRoom.java

/**
 * Moves a file/dir to the waiting room//from   ww w.  jav  a  2  s .  c  o m
 *
 * @param path Path to file/dir
 * @return false if move failed, true otherwise
 */
public boolean moveToWaitingRoom(Path path) throws IOException {
    // Make path absolute
    if (!path.isAbsolute())
        path = new Path(dfs.getWorkingDirectory(), path);

    // Check if path is valid
    if (!dfs.exists(path))
        throw new FileNotFoundException(path.toString());

    // Check if file already in waiting area
    String qPath = path.makeQualified(dfs).toString();
    if (qPath.startsWith(WR.toString()))
        return false;

    // Check if trying to move waiting room or its parent dir to 
    // waiting room
    if (WR.toString().startsWith(qPath)) {
        throw new IOException("Can't delete " + path + " as it contains the waiting room directory.");
    }

    String fName = path.getName();
    Path baseWRPath = getWaitingRoomPath(path.getParent());

    // Make dir(s) for base
    Stack<Path> parentDirs = new Stack<Path>();
    do {
        parentDirs.push(baseWRPath);
        baseWRPath = baseWRPath.getParent();
    } while (baseWRPath != null);

    while (!parentDirs.empty()) {
        baseWRPath = parentDirs.pop();

        // Create new dir with appended .WRx if already exists.
        for (int i = 0; dfs.exists(baseWRPath) && !dfs.getFileStatus(baseWRPath).isDir(); i++) {
            baseWRPath = new Path(baseWRPath.toString() + ".WR" + i);
        }

        if (!dfs.mkdirs(baseWRPath, PERMISSION)) {
            LOG.warn("Couldn't create base dir path in waiting room for " + baseWRPath);
            return false;
        }
    }

    // Rename file/dir to waiting room. Append .WRx if already exists.
    Path myWRPath = new Path(baseWRPath.toString(), fName);
    for (int i = 0; dfs.exists(myWRPath); i++) {
        myWRPath = new Path(myWRPath.toString() + ".WR" + i);
    }

    if (dfs.rename(path, myWRPath))
        return true; // success

    return false;
}

From source file:com.haulmont.cuba.core.app.EntityDiffManager.java

protected EntityDiff getDifferenceByView(EntitySnapshot first, EntitySnapshot second, View diffView) {
    EntityDiff result = new EntityDiff(diffView);
    result.setBeforeSnapshot(first);//  w  w  w .  j ava2 s . c  o  m
    result.setAfterSnapshot(second);

    if (!diffView.getProperties().isEmpty()) {
        Entity firstEntity = first != null ? snapshotAPI.extractEntity(first) : null;
        Entity secondEntity = snapshotAPI.extractEntity(second);

        result.setBeforeEntity(firstEntity);
        result.setAfterEntity(secondEntity);

        Stack<Object> diffBranch = new Stack<>();
        if (secondEntity != null) {
            diffBranch.push(secondEntity);
        }

        List<EntityPropertyDiff> propertyDiffs = getPropertyDiffs(diffView, firstEntity, secondEntity,
                diffBranch);
        result.setPropertyDiffs(propertyDiffs);
    }
    return result;
}

From source file:org.apache.hadoop.tools.DistCp.java

/**
 * Initialize DFSCopyFileMapper specific job-configuration.
 * @param conf : The dfs/mapred configuration.
 * @param jobConf : The handle to the jobConf object to be initialized.
 * @param args Arguments// w ww .  j  ava2  s.  c o m
 * @return true if it is necessary to launch a job.
 */
private static boolean setup(Configuration conf, JobConf jobConf, final Arguments args) throws IOException {
    jobConf.set(DST_DIR_LABEL, args.dst.toUri().toString());

    //set boolean values
    final boolean update = args.flags.contains(Options.UPDATE);
    final boolean skipCRCCheck = args.flags.contains(Options.SKIPCRC);
    final boolean overwrite = !update && args.flags.contains(Options.OVERWRITE);
    jobConf.setBoolean(Options.UPDATE.propertyname, update);
    jobConf.setBoolean(Options.SKIPCRC.propertyname, skipCRCCheck);
    jobConf.setBoolean(Options.OVERWRITE.propertyname, overwrite);
    jobConf.setBoolean(Options.IGNORE_READ_FAILURES.propertyname,
            args.flags.contains(Options.IGNORE_READ_FAILURES));
    jobConf.setBoolean(Options.PRESERVE_STATUS.propertyname, args.flags.contains(Options.PRESERVE_STATUS));

    final String randomId = getRandomId();
    JobClient jClient = new JobClient(jobConf);
    Path stagingArea;
    try {
        stagingArea = JobSubmissionFiles.getStagingDir(jClient, conf);
    } catch (InterruptedException e) {
        throw new IOException(e);
    }

    Path jobDirectory = new Path(stagingArea + NAME + "_" + randomId);
    FsPermission mapredSysPerms = new FsPermission(JobSubmissionFiles.JOB_DIR_PERMISSION);
    // FileSystem.mkdirs(jClient.getFs(), jobDirectory, mapredSysPerms);
    FileSystem.mkdirs(FileSystem.get(jobDirectory.toUri(), conf), jobDirectory, mapredSysPerms);
    jobConf.set(JOB_DIR_LABEL, jobDirectory.toString());

    FileSystem dstfs = args.dst.getFileSystem(conf);

    // get tokens for all the required FileSystems..
    TokenCache.obtainTokensForNamenodes(jobConf.getCredentials(), new Path[] { args.dst }, conf);

    boolean dstExists = dstfs.exists(args.dst);
    boolean dstIsDir = false;
    if (dstExists) {
        dstIsDir = dstfs.getFileStatus(args.dst).isDir();
    }

    // default logPath
    Path logPath = args.log;
    if (logPath == null) {
        String filename = "_distcp_logs_" + randomId;
        if (!dstExists || !dstIsDir) {
            Path parent = args.dst.getParent();
            if (!dstfs.exists(parent)) {
                dstfs.mkdirs(parent);
            }
            logPath = new Path(parent, filename);
        } else {
            logPath = new Path(args.dst, filename);
        }
    }
    FileOutputFormat.setOutputPath(jobConf, logPath);

    // create src list, dst list
    FileSystem jobfs = jobDirectory.getFileSystem(jobConf);

    Path srcfilelist = new Path(jobDirectory, "_distcp_src_files");
    jobConf.set(SRC_LIST_LABEL, srcfilelist.toString());
    SequenceFile.Writer src_writer = SequenceFile.createWriter(jobfs, jobConf, srcfilelist, LongWritable.class,
            FilePair.class, SequenceFile.CompressionType.NONE);

    Path dstfilelist = new Path(jobDirectory, "_distcp_dst_files");
    SequenceFile.Writer dst_writer = SequenceFile.createWriter(jobfs, jobConf, dstfilelist, Text.class,
            Text.class, SequenceFile.CompressionType.NONE);

    Path dstdirlist = new Path(jobDirectory, "_distcp_dst_dirs");
    jobConf.set(DST_DIR_LIST_LABEL, dstdirlist.toString());
    SequenceFile.Writer dir_writer = SequenceFile.createWriter(jobfs, jobConf, dstdirlist, Text.class,
            FilePair.class, SequenceFile.CompressionType.NONE);

    // handle the case where the destination directory doesn't exist
    // and we've only a single src directory OR we're updating/overwriting
    // the contents of the destination directory.
    final boolean special = (args.srcs.size() == 1 && !dstExists) || update || overwrite;
    int srcCount = 0, cnsyncf = 0, dirsyn = 0;
    long fileCount = 0L, byteCount = 0L, cbsyncs = 0L;
    try {
        for (Iterator<Path> srcItr = args.srcs.iterator(); srcItr.hasNext();) {
            final Path src = srcItr.next();
            FileSystem srcfs = src.getFileSystem(conf);
            FileStatus srcfilestat = srcfs.getFileStatus(src);
            Path root = special && srcfilestat.isDir() ? src : src.getParent();
            if (srcfilestat.isDir()) {
                ++srcCount;
            }

            Stack<FileStatus> pathstack = new Stack<FileStatus>();
            for (pathstack.push(srcfilestat); !pathstack.empty();) {
                FileStatus cur = pathstack.pop();
                FileStatus[] children = srcfs.listStatus(cur.getPath());
                for (int i = 0; i < children.length; i++) {
                    boolean skipfile = false;
                    final FileStatus child = children[i];
                    final String dst = makeRelative(root, child.getPath());
                    ++srcCount;

                    if (child.isDir()) {
                        pathstack.push(child);
                    } else {
                        //skip file if the src and the dst files are the same.
                        skipfile = update
                                && sameFile(srcfs, child, dstfs, new Path(args.dst, dst), skipCRCCheck);
                        //skip file if it exceed file limit or size limit
                        skipfile |= fileCount == args.filelimit || byteCount + child.getLen() > args.sizelimit;

                        if (!skipfile) {
                            ++fileCount;
                            byteCount += child.getLen();

                            if (LOG.isTraceEnabled()) {
                                LOG.trace("adding file " + child.getPath());
                            }

                            ++cnsyncf;
                            cbsyncs += child.getLen();
                            if (cnsyncf > SYNC_FILE_MAX || cbsyncs > BYTES_PER_MAP) {
                                src_writer.sync();
                                dst_writer.sync();
                                cnsyncf = 0;
                                cbsyncs = 0L;
                            }
                        }
                    }

                    if (!skipfile) {
                        src_writer.append(new LongWritable(child.isDir() ? 0 : child.getLen()),
                                new FilePair(child, dst));
                    }

                    dst_writer.append(new Text(dst), new Text(child.getPath().toString()));
                }

                if (cur.isDir()) {
                    String dst = makeRelative(root, cur.getPath());
                    dir_writer.append(new Text(dst), new FilePair(cur, dst));
                    if (++dirsyn > SYNC_FILE_MAX) {
                        dirsyn = 0;
                        dir_writer.sync();
                    }
                }
            }
        }
    } finally {
        checkAndClose(src_writer);
        checkAndClose(dst_writer);
        checkAndClose(dir_writer);
    }

    FileStatus dststatus = null;
    try {
        dststatus = dstfs.getFileStatus(args.dst);
    } catch (FileNotFoundException fnfe) {
        LOG.info(args.dst + " does not exist.");
    }

    // create dest path dir if copying > 1 file
    if (dststatus == null) {
        if (srcCount > 1 && !dstfs.mkdirs(args.dst)) {
            throw new IOException("Failed to create" + args.dst);
        }
    }

    final Path sorted = new Path(jobDirectory, "_distcp_sorted");
    checkDuplication(jobfs, dstfilelist, sorted, conf);

    if (dststatus != null && args.flags.contains(Options.DELETE)) {
        deleteNonexisting(dstfs, dststatus, sorted, jobfs, jobDirectory, jobConf, conf);
    }

    Path tmpDir = new Path(
            (dstExists && !dstIsDir) || (!dstExists && srcCount == 1) ? args.dst.getParent() : args.dst,
            "_distcp_tmp_" + randomId);
    jobConf.set(TMP_DIR_LABEL, tmpDir.toUri().toString());
    LOG.info("sourcePathsCount=" + srcCount);
    LOG.info("filesToCopyCount=" + fileCount);
    LOG.info("bytesToCopyCount=" + StringUtils.humanReadableInt(byteCount));
    jobConf.setInt(SRC_COUNT_LABEL, srcCount);
    jobConf.setLong(TOTAL_SIZE_LABEL, byteCount);
    setMapCount(byteCount, jobConf);
    return fileCount > 0;
}

From source file:cn.vlabs.duckling.vwb.tags.ParentTag.java

private Stack<PathElement> getPath(Resource resource) {
    Set<Integer> nodes = new HashSet<Integer>();
    nodes.add(Integer.valueOf(resource.getResourceId()));

    Stack<PathElement> stack = new Stack<PathElement>();
    ViewPortService viewPortService = VWBContext.getContainer().getViewPortService();
    ViewPort vp = viewPortService.getViewPort(vwbcontext.getSiteId(), resource.getResourceId());
    while (vp != null) {
        PathElement pe = new PathElement(vp);
        stack.push(pe);
        if (!vp.isRoot() && vp.getParent() > 0 && !nodes.contains(Integer.valueOf(vp.getParent()))) {
            nodes.add(Integer.valueOf(vp.getParent()));
            vp = viewPortService.getViewPort(vwbcontext.getSiteId(), vp.getParent());
        } else {//  w ww  .  j  a v a2s  . c  om
            vp = null;
        }

    }
    ;

    return stack;
}

From source file:com.webcohesion.ofx4j.io.nanoxml.TestNanoXMLOFXReader.java

/**
 * tests using sax to parse an OFX doc./* ww w .j a va  2 s. c  om*/
 */
public void testVersion1() throws Exception {
    NanoXMLOFXReader reader = new NanoXMLOFXReader();
    final Map<String, List<String>> headers = new HashMap<String, List<String>>();
    final Stack<Map<String, List<Object>>> aggregateStack = new Stack<Map<String, List<Object>>>();
    TreeMap<String, List<Object>> root = new TreeMap<String, List<Object>>();
    aggregateStack.push(root);

    reader.setContentHandler(getNewDefaultHandler(headers, aggregateStack));
    reader.parse(TestNanoXMLOFXReader.class.getResourceAsStream("example-response.ofx"));
    assertEquals(9, headers.size());
    assertEquals(1, aggregateStack.size());
    assertSame(root, aggregateStack.pop());

    TreeMap<String, List<Object>> OFX = (TreeMap<String, List<Object>>) root.remove("OFX").get(0);
    assertNotNull(OFX);

    TreeMap<String, List<Object>> SIGNONMSGSRSV1 = (TreeMap<String, List<Object>>) OFX.remove("SIGNONMSGSRSV1")
            .get(0);
    assertNotNull(SIGNONMSGSRSV1);
    TreeMap<String, List<Object>> SONRS = (TreeMap<String, List<Object>>) SIGNONMSGSRSV1.remove("SONRS").get(0);
    assertNotNull(SONRS);
    TreeMap<String, List<Object>> STATUS = (TreeMap<String, List<Object>>) SONRS.remove("STATUS").get(0);
    assertNotNull(STATUS);
    assertEquals("0", STATUS.remove("CODE").get(0).toString().trim());
    assertEquals("INFO", STATUS.remove("SEVERITY").get(0).toString().trim());
    assertTrue(STATUS.isEmpty());
    assertEquals("20071015021529.000[-8:PST]", SONRS.remove("DTSERVER").get(0).toString().trim());
    assertEquals("ENG", SONRS.remove("LANGUAGE").get(0).toString().trim());
    assertEquals("19900101000000", SONRS.remove("DTACCTUP").get(0).toString().trim());
    TreeMap<String, List<Object>> FI = (TreeMap<String, List<Object>>) SONRS.remove("FI").get(0);
    assertEquals("Bank&Cd", FI.remove("ORG").get(0).toString().trim());
    assertEquals("01234", FI.remove("FID").get(0).toString().trim());
    assertTrue(FI.isEmpty());
    assertTrue(SONRS.isEmpty());
    assertTrue(SIGNONMSGSRSV1.isEmpty());

    TreeMap<String, List<Object>> BANKMSGSRSV1 = (TreeMap<String, List<Object>>) OFX.remove("BANKMSGSRSV1")
            .get(0);
    TreeMap<String, List<Object>> STMTTRNRS = (TreeMap<String, List<Object>>) BANKMSGSRSV1.remove("STMTTRNRS")
            .get(0);
    assertEquals("23382938", STMTTRNRS.remove("TRNUID").get(0).toString().trim());
    STATUS = (TreeMap<String, List<Object>>) STMTTRNRS.remove("STATUS").get(0);
    assertNotNull(STATUS);
    assertEquals("0", STATUS.remove("CODE").get(0).toString().trim());
    assertEquals("INFO", STATUS.remove("SEVERITY").get(0).toString().trim());
    assertTrue(STATUS.isEmpty());
    TreeMap<String, List<Object>> STMTRS = (TreeMap<String, List<Object>>) STMTTRNRS.remove("STMTRS").get(0);
    assertEquals("USD", STMTRS.remove("CURDEF").get(0).toString().trim());
    TreeMap<String, List<Object>> BANKACCTFROM = (TreeMap<String, List<Object>>) STMTRS.remove("BANKACCTFROM")
            .get(0);
    assertEquals("SAVINGS", BANKACCTFROM.remove("ACCTTYPE").get(0).toString().trim());
    assertEquals("098-121", BANKACCTFROM.remove("ACCTID").get(0).toString().trim());
    assertEquals("987654321", BANKACCTFROM.remove("BANKID").get(0).toString().trim());
    assertTrue(BANKACCTFROM.isEmpty());
    TreeMap<String, List<Object>> BANKTRANLIST = (TreeMap<String, List<Object>>) STMTRS.remove("BANKTRANLIST")
            .get(0);
    assertEquals("20070101", BANKTRANLIST.remove("DTSTART").get(0).toString().trim());
    assertEquals("20071015", BANKTRANLIST.remove("DTEND").get(0).toString().trim());
    TreeMap<String, List<Object>> STMTTRN = (TreeMap<String, List<Object>>) BANKTRANLIST.remove("STMTTRN")
            .get(0);
    assertEquals("CREDIT", STMTTRN.remove("TRNTYPE").get(0).toString().trim());
    assertEquals("20070329", STMTTRN.remove("DTPOSTED").get(0).toString().trim());
    assertEquals("20070329", STMTTRN.remove("DTUSER").get(0).toString().trim());
    assertEquals("150.00", STMTTRN.remove("TRNAMT").get(0).toString().trim());
    assertEquals("980310001", STMTTRN.remove("FITID").get(0).toString().trim());
    assertEquals("TRANSFER", STMTTRN.remove("NAME").get(0).toString().trim());
    assertEquals("Transfer from checking &<> etc.", STMTTRN.remove("MEMO").get(0).toString().trim());
    assertTrue(STMTTRN.isEmpty());
    assertTrue(BANKTRANLIST.isEmpty());
    TreeMap<String, List<Object>> LEDGERBAL = (TreeMap<String, List<Object>>) STMTRS.remove("LEDGERBAL").get(0);
    assertEquals("5250.00", LEDGERBAL.remove("BALAMT").get(0).toString().trim());
    assertEquals("20071015021529.000[-8:PST]", LEDGERBAL.remove("DTASOF").get(0).toString().trim());
    assertTrue(LEDGERBAL.isEmpty());
    TreeMap<String, List<Object>> AVAILBAL = (TreeMap<String, List<Object>>) STMTRS.remove("AVAILBAL").get(0);
    assertEquals("5250.00", AVAILBAL.remove("BALAMT").get(0).toString().trim());
    assertEquals("20071015021529.000[-8:PST]", AVAILBAL.remove("DTASOF").get(0).toString().trim());
    assertTrue(AVAILBAL.isEmpty());
    assertTrue(LEDGERBAL.isEmpty());
    assertTrue(STMTRS.isEmpty());
    assertTrue(STMTTRNRS.isEmpty());
    assertTrue(BANKMSGSRSV1.isEmpty());

    assertTrue(OFX.isEmpty());
    assertTrue(root.isEmpty());
}