<commit_before>package codechicken.lib.block.property;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import net.minecraft.block.properties.PropertyHelper;

import javax.annotation.Nonnull;
import java.util.Collection;

/**
 * Created by covers1624 on 5/23/2016.
 */
public class PropertyInteger extends PropertyHelper<Integer> {

    private final ImmutableSet<Integer> valueSet;

    public PropertyInteger(String name, Collection<Integer> values) {
        super(name, Integer.class);
        valueSet = ImmutableSet.copyOf(values);
    }

    //EG, 16 = 0 - 15, 4 = 0 - 3
    public PropertyInteger(String name, int max) {
        super(name, Integer.class);
        ImmutableSet.Builder<Integer> builder = ImmutableSet.builder();
        for (int i = 0; i < max; i++) {
            builder.add(i);
        }
        valueSet = builder.build();
    }

    @Nonnull
    @Override
    public Collection<Integer> getAllowedValues() {
        return valueSet;
    }

    @SuppressWarnings ("Guava")
    @Override
    @Nonnull
    public Optional<Integer> parseValue(@Nonnull String value) {
        if (valueSet.contains(Integer.valueOf(value))) {
            return Optional.of(Integer.valueOf(value));
        }
        return Optional.absent();
    }

    @Nonnull
    @Override
    public String getName(@Nonnull Integer value) {
        return String.valueOf(value);
    }
}
<commit_msg>Fix PropertyInteger.parseValue only handling ints<commit_after>package codechicken.lib.block.property;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import net.minecraft.block.properties.PropertyHelper;

import javax.annotation.Nonnull;
import java.util.Collection;

/**
 * Created by covers1624 on 5/23/2016.
 */
public class PropertyInteger extends PropertyHelper<Integer> {

    private final ImmutableSet<Integer> valueSet;

    public PropertyInteger(String name, Collection<Integer> values) {
        super(name, Integer.class);
        valueSet = ImmutableSet.copyOf(values);
    }

    //EG, 16 = 0 - 15, 4 = 0 - 3
    public PropertyInteger(String name, int max) {
        super(name, Integer.class);
        ImmutableSet.Builder<Integer> builder = ImmutableSet.builder();
        for (int i = 0; i < max; i++) {
            builder.add(i);
        }
        valueSet = builder.build();
    }

    @Nonnull
    @Override
    public Collection<Integer> getAllowedValues() {
        return valueSet;
    }

    @SuppressWarnings ("Guava")
    @Override
    @Nonnull
    public Optional<Integer> parseValue(@Nonnull String value) {
        try {
            Integer intValue = Integer.valueOf(value);
            if (valueSet.contains(intValue) {
                return Optional.of(intValue);
            }
        } catch (NumberFormatException ignored) {
            // Invalid value, let it fall through
        }
        return Optional.absent();
    }

    @Nonnull
    @Override
    public String getName(@Nonnull Integer value) {
        return String.valueOf(value);
    }
}

{'fraction_non_alphanumeric': 0.1077023498694517, 'fraction_numerical': 0.013054830287206266, 'mean_word_length': 2.7196601941747574, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1088176', 'n_tokens_mistral': 899, 'n_tokens_neox': 859, 'n_words': 203}