Example usage for org.apache.commons.lang3 StringUtils isWhitespace

List of usage examples for org.apache.commons.lang3 StringUtils isWhitespace

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isWhitespace.

Prototype

public static boolean isWhitespace(final CharSequence cs) 

Source Link

Document

Checks if the CharSequence contains only whitespace.

null will return false .

Usage

From source file:CSVParser.java

/**
 * Checks if every element is the character sequence is whitespace.
 *
 * precondition: sb.length() is greater than 0
 *
 * @param sb A sequence of characters to examine
 * @return true if every character in the sequence is whitespace
 *//*from  ww  w  .j av  a  2  s  . c  om*/
protected boolean isAllWhiteSpace(CharSequence sb) {
    return StringUtils.isWhitespace(sb);
}

From source file:org.apache.nifi.registry.web.api.ApplicationResource.java

protected URI getBaseUri() {
    final UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
    URI uri = uriBuilder.build();
    try {/*from   w  ww .  jav a  2  s .  c  om*/

        // check for proxy settings
        final String scheme = getFirstHeaderValue(PROXY_SCHEME_HTTP_HEADER, FORWARDED_PROTO_HTTP_HEADER);
        final String host = getFirstHeaderValue(PROXY_HOST_HTTP_HEADER, FORWARDED_HOST_HTTP_HEADER);
        final String port = getFirstHeaderValue(PROXY_PORT_HTTP_HEADER, FORWARDED_PORT_HTTP_HEADER);
        String baseContextPath = getFirstHeaderValue(PROXY_CONTEXT_PATH_HTTP_HEADER,
                FORWARDED_CONTEXT_HTTP_HEADER);

        // if necessary, prepend the context path
        String resourcePath = uri.getPath();
        if (baseContextPath != null) {
            // normalize context path
            if (!baseContextPath.startsWith("/")) {
                baseContextPath = "/" + baseContextPath;
            }

            if (baseContextPath.endsWith("/")) {
                baseContextPath = StringUtils.substringBeforeLast(baseContextPath, "/");
            }

            // determine the complete resource path
            resourcePath = baseContextPath + resourcePath;
        }

        // determine the port uri
        int uriPort = uri.getPort();
        if (port != null) {
            if (StringUtils.isWhitespace(port)) {
                uriPort = -1;
            } else {
                try {
                    uriPort = Integer.parseInt(port);
                } catch (final NumberFormatException nfe) {
                    logger.warn(String.format(
                            "Unable to parse proxy port HTTP header '%s'. Using port from request URI '%s'.",
                            port, uriPort));
                }
            }
        }

        // construct the URI
        uri = new URI((StringUtils.isBlank(scheme)) ? uri.getScheme() : scheme, uri.getUserInfo(),
                (StringUtils.isBlank(host)) ? uri.getHost() : host, uriPort, resourcePath, uri.getQuery(),
                uri.getFragment());

    } catch (final URISyntaxException use) {
        throw new UriBuilderException(use);
    }
    return uri;
}

From source file:org.apache.nifi.web.api.ApplicationResource.java

/**
 * Generate a resource uri based off of the specified parameters.
 *
 * @param path path//from   www . j  a v a 2s  .  c  om
 * @return resource uri
 */
protected String generateResourceUri(final String... path) {
    final UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
    uriBuilder.segment(path);
    URI uri = uriBuilder.build();
    try {

        // check for proxy settings
        final String scheme = httpServletRequest.getHeader(PROXY_SCHEME_HTTP_HEADER);
        final String host = httpServletRequest.getHeader(PROXY_HOST_HTTP_HEADER);
        final String port = httpServletRequest.getHeader(PROXY_PORT_HTTP_HEADER);
        String baseContextPath = httpServletRequest.getHeader(PROXY_CONTEXT_PATH_HTTP_HEADER);

        // if necessary, prepend the context path
        String resourcePath = uri.getPath();
        if (baseContextPath != null) {
            // normalize context path
            if (!baseContextPath.startsWith("/")) {
                baseContextPath = "/" + baseContextPath;
            }

            // determine the complete resource path
            resourcePath = baseContextPath + resourcePath;
        }

        // determine the port uri
        int uriPort = uri.getPort();
        if (port != null) {
            if (StringUtils.isWhitespace(port)) {
                uriPort = -1;
            } else {
                try {
                    uriPort = Integer.parseInt(port);
                } catch (final NumberFormatException nfe) {
                    logger.warn(String.format(
                            "Unable to parse proxy port HTTP header '%s'. Using port from request URI '%s'.",
                            port, uriPort));
                }
            }
        }

        // construct the URI
        uri = new URI((StringUtils.isBlank(scheme)) ? uri.getScheme() : scheme, uri.getUserInfo(),
                (StringUtils.isBlank(host)) ? uri.getHost() : host, uriPort, resourcePath, uri.getQuery(),
                uri.getFragment());

    } catch (final URISyntaxException use) {
        throw new UriBuilderException(use);
    }
    return uri.toString();
}

From source file:org.craftercms.commons.jackson.mvc.GDataPropertyFilter.java

protected List<String> parseRequestSelector(final String selectorStr) {

    if (selectorStr.startsWith(SELECTOR_ALIAS_PREFIX)) {
        String cacheKey = selectorStr.substring(1);
        if (aliasParsedCache.containsKey(cacheKey)) {
            return aliasParsedCache.get(cacheKey);
        } else {//from w  w w. j  av  a  2 s .  c  om
            String aliasStr = alias.get(cacheKey);
            if (aliasStr == null || StringUtils.isWhitespace(aliasStr)) {
                log.error("Selector with name {} is not register or is whitespace ignoring", selectorStr);
                return null;
            }
            List<String> list = internalParser(aliasStr);
            aliasParsedCache.put(cacheKey, list);
            return list;
        }
    } else {
        return internalParser(selectorStr);
    }
}

From source file:org.jamwiki.parser.image.ImageUtil.java

/**
 * Utility method for building an anchor tag that links to an image page
 * and includes the HTML image tag to display the image.
 *
 * @param context The servlet context for the link that is being created.
 * @param linkVirtualWiki The virtual wiki to use when looking up the
 *  image/file, and when linking to the image/file topic page.
 * @param topicName The name of the image for which a link is being
 *  created.// w w w.ja v  a  2s  .co  m
 * @param imageMetadata A container for the image display params, such as
 *  border, alignment, caption, etc.
 * @param style The CSS class to use with the img HTML tag.  This value
 *  can be <code>null</code> or empty if no custom style is used.
 * @param escapeHtml Set to <code>true</code> if the caption should be
 *  HTML escaped.  This value should be <code>true</code> in any case
 *  where the caption is not guaranteed to be free from potentially
 *  malicious HTML code.
 * @param fileVersion If building image HTML for anything other than the
 *  current file version then the version object must be provided, otherwise
 *  this parameter should be <code>null</code>.
 * @return The full HTML required to display an image enclosed within an
 *  HTML anchor tag that links to the image topic page.
 * @throws DataAccessException Thrown if any error occurs while retrieving image
 *  information.
 * @throws IOException Thrown if any error occurs while reading image information.
 */
public static String buildImageLinkHtml(String context, String linkVirtualWiki, String topicName,
        ImageMetadata imageMetadata, String style, boolean escapeHtml, WikiFileVersion fileVersion)
        throws DataAccessException, IOException {
    String url = ImageUtil.buildImageFileUrl(context, linkVirtualWiki, topicName, false);
    if (url == null) {
        return ImageUtil.buildUploadLink(context, linkVirtualWiki, topicName);
    }
    Topic topic = WikiBase.getDataHandler().lookupTopic(linkVirtualWiki, topicName, false);
    String caption = imageMetadata.getCaption();
    if (topic.getTopicType() == TopicType.FILE) {
        // file, not an image - use the file name, minus the translated/untranslated namespace
        return ImageUtil.buildLinkToFile(url, topic, caption, escapeHtml);
    }
    WikiFile wikiFile = WikiBase.getDataHandler().lookupWikiFile(topic.getVirtualWiki(), topic.getName());
    WikiImage wikiImage = null;
    try {
        wikiImage = ImageUtil.initializeWikiImage(wikiFile, imageMetadata, fileVersion);
    } catch (FileNotFoundException e) {
        // do not log the full exception as the logs can fill up very for this sort of error, and it is generally due to a bad configuration.  instead log a warning message so that the administrator can try to fix the problem
        logger.warn("File not found while parsing image link for topic: " + topic.getVirtualWiki() + " / "
                + topicName
                + ".  Make sure that the following file exists and is readable by the JAMWiki installation: "
                + e.getMessage());
        return ImageUtil.buildUploadLink(context, topic.getVirtualWiki(), topicName);
    }
    if (wikiImage == null) {
        return ImageUtil.buildLinkToFile(url, topic, caption, escapeHtml);
    }
    if (StringUtils.isBlank(style)) {
        style = "wikiimg";
    }
    if (imageMetadata.getBordered()) {
        style += " thumbborder";
    }
    Object[] args = (imageMetadata.getVerticalAlignment() != ImageVerticalAlignmentEnum.NOT_SPECIFIED)
            ? new Object[6]
            : new Object[5];
    args[0] = style;
    args[1] = buildImageUrl(context, wikiImage.getUrl(), false);
    args[2] = wikiImage.getWidth();
    args[3] = wikiImage.getHeight();
    String alt = (imageMetadata.getAlt() == null) ? topicName : imageMetadata.getAlt();
    args[4] = StringEscapeUtils.escapeHtml4(alt);
    // TODO: combine the standard & vertical templates by adding a CSS class for
    // vertical alignment
    String template = TEMPLATE_IMAGE_IMG_STANDARD;
    if (imageMetadata.getVerticalAlignment() != ImageVerticalAlignmentEnum.NOT_SPECIFIED) {
        template = TEMPLATE_IMAGE_IMG_VERTICAL;
        args[5] = imageMetadata.getVerticalAlignment().toString();
    }
    StringBuilder html = new StringBuilder();
    String imageHtml = WikiUtil.formatFromTemplate(template, args);
    if (!StringUtils.isWhitespace(imageMetadata.getLink())) {
        // wrap the image in a link
        if (imageMetadata.getLink() == null) {
            // no link set, link to the image topic page.  At this point we have validated
            // that the link is an image, so do not perform further validation and link to the
            // CURRENT virtual wiki, even if it is a shared image
            WikiLink wikiLink = new WikiLink(context, linkVirtualWiki, topicName);
            String link = wikiLink.toRelativeUrl();
            html.append("<a class=\"wikiimg\" href=\"").append(link).append("\"");
            if (!StringUtils.isBlank(imageMetadata.getTitle())) {
                html.append(" title=\"").append(StringEscapeUtils.escapeHtml4(imageMetadata.getTitle()))
                        .append("\"");
            }
            html.append(">");
            html.append(imageHtml);
            html.append("</a>");
        } else {
            try {
                // try to parse as an external link
                html.append(LinkUtil.buildExternalLinkHtml(imageMetadata.getLink(), "wikiimg", imageHtml));
            } catch (ParserException e) {
                // not an external link, but an internal link
                WikiLink wikiLink = LinkUtil.parseWikiLink(context, topic.getVirtualWiki(),
                        imageMetadata.getLink());
                String link = LinkUtil.buildTopicUrl(wikiLink);
                html.append("<a class=\"wikiimg\" href=\"").append(link).append("\"");
                if (!StringUtils.isBlank(imageMetadata.getTitle())) {
                    html.append(" title=\"").append(StringEscapeUtils.escapeHtml4(imageMetadata.getTitle()))
                            .append("\"");
                }
                html.append(">");
                html.append(imageHtml);
                html.append("</a>");
            }
        }
    } else {
        html.append(imageHtml);
    }
    if (!StringUtils.isBlank(caption) && imageMetadata.getBorder() != ImageBorderEnum._GALLERY) {
        // captions are only displayed for thumbnails and framed images.  galleries are handled separately.
        html.append("\n<div class=\"thumbcaption\">");
        if (escapeHtml) {
            html.append(StringEscapeUtils.escapeHtml4(caption));
        } else {
            html.append(caption);
        }
        html.append("</div>\n");
    }
    return ImageUtil.buildWrappedImageDiv(imageMetadata, wikiImage.getWidth(), wikiImage.getHeight(),
            html.toString());
}

From source file:org.jsweet.transpiler.JSweetTranspiler.java

private void generateTsFiles(ErrorCountTranspilationHandler transpilationHandler, SourceFile[] files,
        List<JCCompilationUnit> compilationUnits) throws IOException {
    // regular file-to-file generation
    new OverloadScanner<C>(transpilationHandler, context).process(compilationUnits);
    for (int i = 0; i < compilationUnits.length(); i++) {
        JCCompilationUnit cu = compilationUnits.get(i);
        if (isModuleDefsFile(cu)) {
            if (context.useModules) {
                generateModuleDefs(cu);//from  w  w w . j a v  a 2s.  co  m
            }
            continue;
        }
        logger.info("scanning " + cu.sourcefile.getName() + "...");
        AbstractTreePrinter<C> printer = factory.createTranslator(factory.createAdapter(context),
                transpilationHandler, context, cu, generateSourceMap);
        printer.print(cu);
        if (StringUtils.isWhitespace(printer.getResult())) {
            continue;
        }
        String[] s = cu.getSourceFile().getName().split(File.separator.equals("\\") ? "\\\\" : File.separator);
        String cuName = s[s.length - 1];
        s = cuName.split("\\.");
        cuName = s[0];
        String javaSourceFileRelativeFullName = (cu.packge.getQualifiedName().toString().replace(".",
                File.separator) + File.separator + cuName + ".java");
        files[i].javaSourceDirRelativeFile = new File(javaSourceFileRelativeFullName);
        files[i].javaSourceDir = new File(cu.getSourceFile().getName().substring(0,
                cu.getSourceFile().getName().length() - javaSourceFileRelativeFullName.length()));
        String packageName = isNoRootDirectories() ? context.getRootRelativeJavaName(cu.packge)
                : cu.packge.getQualifiedName().toString();
        String outputFileRelativePathNoExt = packageName.replace(".", File.separator) + File.separator + cuName;
        String outputFileRelativePath = outputFileRelativePathNoExt
                + (cu.packge.fullname.toString().startsWith("def.") ? ".d.ts" : ".ts");
        logger.info("output file: " + outputFileRelativePath);
        File outputFile = new File(tsOutputDir, outputFileRelativePath);
        outputFile.getParentFile().mkdirs();
        String outputFilePath = outputFile.getPath();
        PrintWriter out = new PrintWriter(outputFilePath);
        try {
            out.println(printer.getResult());
            out.print(context.getGlobalsMappingString());
            out.print(context.poolFooterStatements());
        } finally {
            out.close();
        }
        files[i].tsFile = outputFile;
        files[i].javaFileLastTranspiled = files[i].getJavaFile().lastModified();
        files[i].setSourceMap(printer.sourceMap);
        if (generateSourceMap && !generateJsFiles) {
            generateTypeScriptSourceMapFile(files[i]);
        }
        logger.info("created " + outputFilePath);
    }
}

From source file:org.languagetool.tagging.de.GermanTagger.java

private List<AnalyzedToken> getImperativeForm(String word, List<String> sentenceTokens, int pos) {
    int idx = sentenceTokens.indexOf(word);
    String previousWord = "";
    while (--idx > -1) {
        previousWord = sentenceTokens.get(idx);
        if (!StringUtils.isWhitespace(previousWord)) {
            break;
        }//from w  w w. ja  v  a 2s.c om
    }
    if (!(pos == 0 && sentenceTokens.size() > 1) && !StringUtils.equalsAnyIgnoreCase(previousWord, "ich", "er",
            "es", "sie", "bitte", "aber", "nun", "jetzt", "")) {
        return Collections.emptyList();
    }
    String w = pos == 0 || "".equals(previousWord) ? word.toLowerCase() : word;
    List<TaggedWord> taggedWithE = getWordTagger().tag(w.concat("e"));
    for (TaggedWord tagged : taggedWithE) {
        if (tagged.getPosTag().startsWith("VER:IMP:SIN:")) {
            // do not overwrite manually removed tags
            if (removalTagger == null || !removalTagger.tag(w).contains(tagged)) {
                return getAnalyzedTokens(Arrays.asList(tagged), word);
            }
            break;
        }
    }
    return Collections.emptyList();
}

From source file:org.languagetool.tagging.de.GermanTagger.java

private List<AnalyzedToken> getSubstantivatedForms(String word, List<String> sentenceTokens, int pos) {
    if (word.endsWith("er")) {
        List<TaggedWord> lowerCaseTags = getWordTagger().tag(word.toLowerCase());
        // do not add tag words whose lower case variant is an adverb (e.g, "Frher") to avoid false negatives for DE_CASE
        if (lowerCaseTags.stream().anyMatch(t -> t.getPosTag().startsWith("ADV"))) {
            return Collections.emptyList();
        }//from w  w  w . j a v a 2 s.co  m
        int idx = sentenceTokens.indexOf(word);
        // is followed by an uppercase word? If 'yes', the word is probably not substantivated
        while (++idx < sentenceTokens.size()) {
            String nextWord = sentenceTokens.get(idx);
            if (StringUtils.isWhitespace(nextWord)) {
                continue;
            }
            if (nextWord.length() > 0
                    && (Character.isUpperCase(nextWord.charAt(0)) || "als".equals(nextWord))) {
                return Collections.emptyList();
            }
            break;
        }
        String femaleForm = word.substring(0, word.length() - 1);
        List<TaggedWord> taggedFemaleForm = getWordTagger().tag(femaleForm);
        boolean isSubstantivatedForm = taggedFemaleForm.stream()
                .anyMatch(t -> t.getPosTag().equals("SUB:NOM:SIN:FEM:ADJ"));
        if (isSubstantivatedForm) {
            List<AnalyzedToken> list = new ArrayList<>();
            list.add(new AnalyzedToken(word, "SUB:NOM:SIN:MAS:ADJ", word));
            list.add(new AnalyzedToken(word, "SUB:GEN:PLU:MAS:ADJ", word));
            return list;
        }
    }
    return Collections.emptyList();
}

From source file:org.structr.web.Importer.java

private void createChildNodes(final Node startNode, final DOMNode parent, final Page page,
        final boolean removeHashAttribute) throws FrameworkException {

    Linkable res = null;//from  w w w .  j  a va 2s.c  o m
    final List<Node> children = startNode.childNodes();
    for (Node node : children) {

        String tag = node.nodeName();

        // clean tag, remove non-word characters
        if (tag != null) {
            tag = tag.replaceAll("[^a-zA-Z0-9#]+", "");
        }

        String type = CaseHelper.toUpperCamelCase(tag);
        String comment = null;
        String content = null;
        String id = null;
        StringBuilder classString = new StringBuilder();

        if (ArrayUtils.contains(ignoreElementNames, type)) {

            continue;
        }

        if (node instanceof Element) {

            Element el = ((Element) node);
            Set<String> classes = el.classNames();

            for (String cls : classes) {

                classString.append(cls).append(" ");
            }

            id = el.id();

            String downloadAddressAttr = (ArrayUtils.contains(srcElements, tag) ? "src"
                    : ArrayUtils.contains(hrefElements, tag) ? "href" : null);

            if (downloadAddressAttr != null && StringUtils.isNotBlank(node.attr(downloadAddressAttr))) {

                String downloadAddress = node.attr(downloadAddressAttr);
                res = downloadFile(downloadAddress, originalUrl);

            }

            if (removeHashAttribute) {

                // Remove data-structr-hash attribute
                node.removeAttr(DOMNode.dataHashProperty.jsonName());

            }

        }

        // Data and comment nodes: Trim the text and put it into the "content" field without changes
        if (/*type.equals("#data") || */type.equals("#comment")) {

            tag = "";
            comment = ((Comment) node).getData();

            // Don't add content node for whitespace
            if (StringUtils.isBlank(comment)) {

                continue;
            }

            // store for later use
            commentSource.append(comment).append("\n");

        } else if (type.equals("#data")) {

            tag = "";
            content = ((DataNode) node).getWholeData();

            // Don't add content node for whitespace
            if (StringUtils.isBlank(content)) {

                continue;
            }

        } else // Text-only nodes: Trim the text and put it into the "content" field
        {
            if (type.equals("#text")) {

                //                              type    = "Content";
                tag = "";
                //content = ((TextNode) node).getWholeText();
                content = ((TextNode) node).text();

                // Add content node for whitespace within <p> elements only
                if (!("p".equals(startNode.nodeName().toLowerCase())) && StringUtils.isWhitespace(content)) {

                    continue;
                }
            }
        }

        org.structr.web.entity.dom.DOMNode newNode;

        // create node
        if (StringUtils.isBlank(tag)) {

            // create comment or content node
            if (!StringUtils.isBlank(comment)) {

                newNode = (DOMNode) page.createComment(comment);
                newNode.setProperty(org.structr.web.entity.dom.Comment.contentType, "text/html");

            } else {

                newNode = (Content) page.createTextNode(content);
            }

        } else {

            newNode = (org.structr.web.entity.dom.DOMElement) page.createElement(tag);
        }

        if (newNode != null) {

            newNode.setProperty(AbstractNode.visibleToPublicUsers, publicVisible);
            newNode.setProperty(AbstractNode.visibleToAuthenticatedUsers, authVisible);

            if (res != null) {

                newNode.setProperty(LinkSource.linkable, res);

            }

            // "id" attribute: Put it into the "_html_id" field
            if (StringUtils.isNotBlank(id)) {

                newNode.setProperty(DOMElement._id, id);
            }

            if (StringUtils.isNotBlank(classString.toString())) {

                newNode.setProperty(DOMElement._class, StringUtils.trim(classString.toString()));
            }

            for (Attribute nodeAttr : node.attributes()) {

                final String key = nodeAttr.getKey();

                if (!key.equals("text")) { // Don't add text attribute as _html_text because the text is already contained in the 'content' attribute

                    final String value = nodeAttr.getValue();

                    if (key.startsWith("data-")) {

                        if (key.startsWith(DATA_META_PREFIX)) { // convert data-structr-meta-* attributes to local camel case properties on the node,

                            int l = DATA_META_PREFIX.length();

                            String upperCaseKey = WordUtils.capitalize(key.substring(l), new char[] { '-' })
                                    .replaceAll("-", "");
                            String camelCaseKey = key.substring(l, l + 1).concat(upperCaseKey.substring(1));

                            if (value != null) {
                                if (value.equalsIgnoreCase("true")) {
                                    newNode.setProperty(new BooleanProperty(camelCaseKey), true);
                                } else if (value.equalsIgnoreCase("false")) {
                                    newNode.setProperty(new BooleanProperty(camelCaseKey), false);
                                } else {
                                    newNode.setProperty(new StringProperty(camelCaseKey), nodeAttr.getValue());
                                }
                            }

                        } else if (key.startsWith(DATA_STRUCTR_PREFIX)) { // don't convert data-structr-* attributes as they are internal

                            PropertyKey propertyKey = config.getPropertyKeyForJSONName(newNode.getClass(), key);

                            if (propertyKey != null) {

                                final PropertyConverter inputConverter = propertyKey
                                        .inputConverter(securityContext);
                                if (value != null && inputConverter != null) {

                                    newNode.setProperty(propertyKey,
                                            propertyKey.inputConverter(securityContext).convert(value));
                                } else {

                                    newNode.setProperty(propertyKey, value);
                                }
                            }
                        }

                    } else {

                        boolean notBlank = StringUtils.isNotBlank(value);
                        boolean isAnchor = notBlank && value.startsWith("#");
                        boolean isLocal = notBlank && !value.startsWith("http");
                        boolean isActive = notBlank && value.contains("${");
                        boolean isStructrLib = notBlank && value.startsWith("/structr/js/");

                        if ("link".equals(tag) && "href".equals(key) && isLocal && !isActive) {

                            newNode.setProperty(new StringProperty(PropertyView.Html.concat(key)),
                                    "${link.path}?${link.version}");

                        } else if (("href".equals(key) || "src".equals(key)) && isLocal && !isActive
                                && !isAnchor && !isStructrLib) {

                            newNode.setProperty(new StringProperty(PropertyView.Html.concat(key)),
                                    "${link.path}");

                        } else {

                            newNode.setProperty(new StringProperty(PropertyView.Html.concat(key)), value);
                        }

                    }
                }

            }

            final StringProperty typeKey = new StringProperty(PropertyView.Html.concat("type"));

            if ("script".equals(tag) && newNode.getProperty(typeKey) == null) {

                // Set default type of script tag to "text/javascript" to ensure inline JS gets imported properly
                newNode.setProperty(typeKey, "text/javascript");
            }

            parent.appendChild(newNode);

            // Link new node to its parent node
            // linkNodes(parent, newNode, page, localIndex);
            // Step down and process child nodes
            createChildNodes(node, newNode, page, removeHashAttribute);

        }
    }
}

From source file:org.trimou.engine.parser.SegmentBases.java

/**
 *
 * @param line/* ww  w  .jav a 2 s  . com*/
 * @return
 */
static boolean isStandaloneLine(List<SegmentBase> line) {

    boolean standaloneCandidate = false;

    for (SegmentBase segment : line) {
        if (SegmentType.VALUE.equals(segment.getType())) {
            // Value segment
            return false;
        } else if (SegmentType.TEXT.equals(segment.getType())) {
            if (!StringUtils.isWhitespace(segment.getContent())) {
                // Text segment with non-whitespace character
                return false;
            }
        } else if (isStandaloneCandidate(segment.getType())) {
            standaloneCandidate = true;
        }
    }
    return standaloneCandidate;
}