package konstructs.api;

/**
 * BlockFilterFactory is a class with static factory methods for quickly
 * and easily creating BlockFilters. A simple example:
 * <pre>
 *     BlockFilterFactory
 *         .withName("grass")
 *         .withObstacle(true)
 *         .or(BlockFilterFactory
 *             .withNamespace("org/konstructs"));
 * </pre>
 * This creates a filter that matches blocks that are named "grass" AND are obstacles
 * OR blocks that have the namespace "org/konstructs".
 */
public class BlockFilterFactory {
    /**
     * The EMPTY BlockFilter matches everything.
     */
    public static BlockFilterNode EMPTY = new BlockFilterNode(null, null, null, null, null);

    /**
     * The VACUUM BlockFilter matches only VACUUM.
     */
    public static BlockFilterNode VACUUM = EMPTY.withBlockTypeId(BlockTypeId.VACUUM);

    /**
     * Factory method to create a BlockFilter with the given namespace
     * @param namespace The namespace to set in the new BlockFilter
     * @return The new BlockFilter with namespace set
     */
    public static BlockFilterNode withNamespace(String namespace) {
        return EMPTY.withNamespace(namespace);
    }

    /**
     * Factory method to create a BlockFilter with the given name
     * @param name The name to set in the new BlockFilter
     * @return The new BlockFilter with name set
     */
    public static BlockFilterNode withName(String name) {
        return EMPTY.withName(name);
    }

    /**
     * Factory method to create a BlockFilter with the given BlockTypeId.
     * This method sets both the namespace and the name.
     * @param blockTypeId The BlockTypeId to set in the new BlockFilter
     * @return The new BlockFilter with both namespace and name set
     */
    public static BlockFilterNode withBlockTypeId(BlockTypeId blockTypeId) {
        return EMPTY.withBlockTypeId(blockTypeId);
    }

    /**
     * Factory method to create a BlockFilter with the given shape
     * @param shape The shape to set in the new BlockFilter
     * @return The new BlockFilter with the shape set
     */
    public static BlockFilterNode withShape(String shape) {
        return EMPTY.withShape(shape);
    }

    /**
     * Factory method to create a BlockFilter with transparent property set
     * @param transparent Must the block be transparent to match?
     * @return The new BlockFilter with the transparent property set
     */
    public static BlockFilterNode withTransparent(Boolean transparent) {
        return EMPTY.withTransparent(transparent);
    }

    /**
     * Factory method to create a new BlockFilter with the obstacle property set
     * @param obstacle Must the block be an obstacle to match?
     * @return The new BlockFilter with the obstacle property set
     */
    public static BlockFilterNode withObstacle(Boolean obstacle) {
        return EMPTY.withObstacle(obstacle);
    }
}

@@ -539,20 +539,25 @@
  * The E
-MPTY
+VERYTHING
  BlockFi
@@ -599,32 +599,38 @@
   public static 
+final 
 BlockFilterNode 
@@ -630,20 +630,25 @@
 erNode E
-MPTY
+VERYTHING
  = new B
@@ -690,24 +690,588 @@
 ll, null);%0A%0A
+    /**%0A     * The EMPTY BlockFilter is an alias for the EVERYTHING BlockFilter%0A     */%0A    public static final BlockFilterNode EMPTY = EVERYTHING;%0A%0A    /**%0A     * The NOTHING BlockFilter matches nothing.%0A     */%0A    public static final BlockFilter NOTHING = new BlockFilter() %7B%0A            @Override%0A            public boolean matches(BlockTypeId blockTypeId, BlockType blockType) %7B%0A                return false;%0A            %7D%0A%0A            @Override%0A            public BlockFilter or(BlockFilter filter) %7B%0A                return filter;%0A            %7D%0A        %7D;%0A%0A
     /**%0A    

Add a NOTHING BlockFilter