001package de.monochromata.anaphors.cog.transform;
002
003import de.monochromata.anaphors.cog.memory.Chunk;
004
005/**
006 * @param <N> The node type in the AST
007 * @param <E> The expression type
008 * @param <S> The scope type (optional)
009 */
010public abstract class AbstractCheckResult<N, E, S> implements CheckResult<N, E, S> {
011
012    private final Chunk<N> chunk;
013    private final E definiteExpression;
014    private final S scope;
015    private final boolean canPerformTransformation;
016
017    /**
018     * Used in contract testing.
019     */
020    @SuppressWarnings("unused")
021    protected AbstractCheckResult() {
022        this(null, null, null, false);
023    }
024
025    public AbstractCheckResult(final Chunk<N> chunk, final E definiteExpression, final S scope,
026            final boolean canPerformTransformation) {
027        this.chunk = chunk;
028        this.definiteExpression = definiteExpression;
029        this.scope = scope;
030        this.canPerformTransformation = canPerformTransformation;
031    }
032
033    @Override
034    public Chunk<N> getChunk() {
035        return chunk;
036    }
037
038    @Override
039    public E getDefiniteExpression() {
040        return definiteExpression;
041    }
042
043    @Override
044    public S getScope() {
045        return scope;
046    }
047
048    @Override
049    public boolean canPerformTransformation() {
050        return canPerformTransformation;
051    }
052
053}