public static LinkedList getTraversal(Trace[] topTraces) {
public static LinkedList<Trace> getTraversal(Trace[] topTraces) {
    public static LinkedList getTraversal(Trace[] topTraces) {        LinkedList schedule = new LinkedList();        HashSet visited = new HashSet();        LinkedList queue = new LinkedList();        for (int i = 0; i < topTraces.length; i++) {            queue.add(topTraces[i]);            while (!queue.isEmpty()) {                Trace trace = (Trace) queue.removeFirst();                if (!visited.contains(trace)) {                    visited.add(trace);                    Iterator dests = trace.getTail().getDestSet().iterator();                    while (dests.hasNext()) {                        Trace current = ((Edge) dests.next()).getDest()                            .getParent();                        if (!visited.contains(current)) {                            // only add if all sources has been visited                            Iterator sources = current.getHead().getSourceSet()                                .iterator();                            boolean addMe = true;                            while (sources.hasNext()) {                                if (!visited.contains(((Edge) sources.next())                                                      .getSrc().getParent())) {                                    addMe = false;                                    break;                                }                            }                            if (addMe)                                queue.add(current);                        }                    }                    if (!trace.getHead().getNextFilter().isPredefined()) {                        schedule.add(trace);                    }                }            }        }        return schedule;    }