Example usage for org.apache.commons.net.nntp Threadable isDummy

List of usage examples for org.apache.commons.net.nntp Threadable isDummy

Introduction

In this page you can find the example usage for org.apache.commons.net.nntp Threadable isDummy.

Prototype

public boolean isDummy();

Source Link

Usage

From source file:org.ossmeter.metricprovider.trans.newsgroups.threads.Threader.java

/**
 * The client passes in a list of Iterable objects, and
 * the Threader constructs a connected 'graph' of messages
 * @param messages iterable of messages to thread
 * @return null if messages == null or root.child == null
 * @since 3.0//  www. j a va2  s  . com
 */
public Threadable thread(Iterable<? extends Threadable> messages) {
    if (messages == null) {
        return null;
    }

    idTable = new HashMap<String, ThreadContainer>();

    // walk through each Threadable element
    for (Threadable t : messages) {
        if (!t.isDummy()) {
            buildContainer(t);
        }
    }

    root = findRootSet();
    idTable.clear();
    idTable = null;

    pruneEmptyContainers(root);

    root.reverseChildren();
    gatherSubjects();

    if (root.next != null) {
        throw new RuntimeException("root node has a next:" + root);
    }

    for (ThreadContainer r = root.child; r != null; r = r.next) {
        if (r.threadable == null) {
            r.threadable = r.child.threadable.makeDummy();
        }
    }

    Threadable result = (root.child == null ? null : root.child.threadable);
    root.flush();
    root = null;

    return result;
}