package common.properties;

import java.util.Collection;
import java.util.function.Predicate;

import common.collect.Filter;
import common.collect.Lists;
import common.util.Facing;
import common.util.Predicates;

public class PropertyDirection extends PropertyEnum<Facing>
{
    protected PropertyDirection(String name, Collection<Facing> values)
    {
        super(name, Facing.class, values);
    }

    /**
     * Create a new PropertyDirection with the given name
     */
    public static PropertyDirection create(String name)
    {
        return create(name, Predicates.<Facing>alwaysTrue());
    }

    /**
     * Create a new PropertyDirection with all directions that match the given Predicate
     */
    public static PropertyDirection create(String name, Predicate<Facing> filter)
    {
        return create(name, Filter.<Facing>filter(Lists.newArrayList(Facing.values()), filter));
    }

    /**
     * Create a new PropertyDirection for the given direction values
     */
    public static PropertyDirection create(String name, Collection<Facing> values)
    {
        return new PropertyDirection(name, values);
    }
}
