Search in sources :

Example 1 with Processor

use of spoon.processing.Processor in project spoon by INRIA.

the class QueueProcessingManager method process.

public void process(Collection<? extends CtElement> elements) {
    Processor<?> p;
    // copy so that one can reuse the processing manager
    // among different processing steps
    Queue<Processor<?>> processors = new LinkedList<>(getProcessors());
    while ((p = processors.poll()) != null) {
        try {
            getFactory().getEnvironment().reportProgressMessage(p.getClass().getName());
            current = p;
            // load the properties
            p.init();
            p.process();
            for (CtElement e : new ArrayList<>(elements)) {
                getVisitor().setProcessor(p);
                getVisitor().scan(e);
            }
        } catch (ProcessInterruption ignore) {
        } finally {
            p.processingDone();
        }
    }
}
Also used : Processor(spoon.processing.Processor) CtElement(spoon.reflect.declaration.CtElement) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) ProcessInterruption(spoon.processing.ProcessInterruption)

Aggregations

ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 ProcessInterruption (spoon.processing.ProcessInterruption)1 Processor (spoon.processing.Processor)1 CtElement (spoon.reflect.declaration.CtElement)1