package domain.fluents;

import domain.AtomicFluent;
import domain.BlockType;
import main.Observations;

public class BlockAt implements AtomicFluent {
    private final float mX;
    private final float mZ;
    private final float mY;
    private final BlockType mTypeOfBlock;


    public BlockAt(float x, float y, float z, BlockType type){
        this.mX = x;
        this.mY = y;
        this.mZ = z;

        mTypeOfBlock = type;
    }

    public String getTypeOfBlockString(){
        return mTypeOfBlock.name();
    }

    @Override
    public boolean test(Observations observations) {
        BlockAt blockAt = observations.blockAt(mX, mY, mZ);
        if (mTypeOfBlock.equals(BlockType.Any)) {
            return !mTypeOfBlock.equals(BlockType.air);
        }
        return mTypeOfBlock.equals(blockAt.getTypeOfBlock());
    }

    public float getX() {
        return mX;
    }

    public float getY() {
        return mY;
    }

    public float getZ() {
        return mZ;
    }

    public BlockType getTypeOfBlock(){
        return mTypeOfBlock;
    }

    // for test purposes
    @Override
    public String toString() {
        return "Block Type: " + mTypeOfBlock.toString() + ", x: " + mX + ", y: " + mY + ", z: " + mZ;
    }
}

@@ -665,38 +665,41 @@
 f (mTypeOfBlock.
-equals
+compareTo
 (BlockType.Any))
@@ -697,16 +697,21 @@
 ype.Any)
+ == 0
 ) %7B%0A    
@@ -800,22 +800,25 @@
 OfBlock.
-equals
+compareTo
 (blockAt
@@ -835,16 +835,21 @@
 Block())
+ == 0
 ;%0A    %7D%0A

Fix BlockAt uses equals for enums instead of compareTo