Example usage for java.util Deque contains

List of usage examples for java.util Deque contains

Introduction

In this page you can find the example usage for java.util Deque contains.

Prototype

boolean contains(Object o);

Source Link

Document

Returns true if this deque contains the specified element.

Usage

From source file:org.polymap.core.data.pipeline.DefaultPipelineIncubator.java

protected boolean findTransformation(ProcessorDescription from, ProcessorDescription to, LayerUseCase usecase,
        Deque<ProcessorDescription> chain) {
    log.debug(StringUtils.repeat("    ", chain.size()) + "findTransformation: " + from + " => " + to + " -- "
            + usecase);//  w  w w  .  j  a  v a 2 s. c  o m

    // recursion break
    if (chain.size() > 16) {
        return false;
    }

    // recursion start
    if (from.getSignature().isCompatible(to.getSignature())) {
        chain.addLast(to);
        log.debug(StringUtils.repeat("    ", chain.size()) + "Transformation found: " + chain);
        return true;
    }

    // recursion step
    else {
        for (ProcessorDescription desc : allTransformers(usecase)) {
            if (from.getSignature().isCompatible(desc.getSignature()) && !chain.contains(desc)) {
                chain.addLast(desc);
                if (findTransformation(desc, to, usecase, chain)) {
                    //log.debug( "      transformation found: " + desc );
                    return true;
                }
                chain.removeLast();
            }
        }
        return false;
    }
}