Package com.cloudbees.groovy.cps.impl

Source Code of com.cloudbees.groovy.cps.impl.NotBlock

package com.cloudbees.groovy.cps.impl;

import com.cloudbees.groovy.cps.Block;
import com.cloudbees.groovy.cps.Continuation;
import com.cloudbees.groovy.cps.Env;
import com.cloudbees.groovy.cps.Next;
import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation;

/**
* !b
*
* @author Kohsuke Kawaguchi
*/
public class NotBlock implements Block {
    private final Block b;

    public NotBlock(Block b) {
        this.b = b;
    }

    public Next eval(Env e, final Continuation k) {
        return b.eval(e,new Continuation() {
            public Next receive(Object o) {
                boolean b = DefaultTypeTransformation.booleanUnbox(o);
                return k.receive(!b);
            }
        });
    }

    private static final long serialVersionUID = 1L;
}
TOP

Related Classes of com.cloudbees.groovy.cps.impl.NotBlock

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.