All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pitest.sequence.EmptyContext Maven / Gradle / Ivy

The newest version!
package org.pitest.sequence;

import java.util.Optional;

/**
 * Specialisation of context with no data
 */
enum EmptyContext implements Context {

    WITHOUT_DEBUG(false),
    WITH_DEBUG(true);

    private final boolean debug;

    EmptyContext(boolean debug) {
        this.debug = debug;
    }

    @Override
    public boolean debug() {
        return debug;
    }

    @Override
    public  Context store(SlotWrite slot, S value) {
        return new Context1(slot.slot(), value, debug);
    }

    @SuppressWarnings("unchecked")
    @Override
    public  Optional retrieve(SlotRead slot) {
        return Optional.empty();
    }

}