<commit_before>/*
 * Copyright 2014-2017 Web Firm Framework
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * @author WFF
 */
package com.webfirmframework.wffweb.css;

import java.util.Arrays;
import java.util.List;

import com.webfirmframework.wffweb.InvalidValueException;
import com.webfirmframework.wffweb.NullValueException;
import com.webfirmframework.wffweb.css.core.AbstractCssProperty;

/**
 * <pre>
 * The margin-bottom property sets the bottom margin of an element.
 *
 * Note: Negative values are allowed.
 * Default value:  0
 * Inherited:      no
 * Animatable:     yes
 * Version:        CSS1
 * JavaScript syntax:      object.style.marginBottom="100px"
 * </pre>
 *
 * @author WFF
 * @since 1.0.0
 */
public class MarginBottom extends AbstractCssProperty<MarginBottom> {

    private static final long serialVersionUID = 1_0_0L;

    public static final String INITIAL = "initial";
    public static final String INHERIT = "inherit";
    public static final String AUTO = "auto";

    private static final List<String> PREDEFINED_CONSTANTS = Arrays
            .asList(INITIAL, INHERIT, AUTO);

    private String cssValue;
    private Float value;
    private CssLengthUnit cssLengthUnit;

    /**
     * The {@code auto} will be set as the value
     */
    public MarginBottom() {
        setCssValue("0px");
    }

    /**
     * @param cssValue
     *            the css value to set.
     */
    public MarginBottom(final String cssValue) {
        setCssValue(cssValue);
    }

    /**
     * @param widthtCss
     *            the {@code MarginBottom} object from which the cssValue to
     *            set.And, {@code null} will throw {@code NullValueException}
     */
    public MarginBottom(final MarginBottom marginBottom) {
        if (marginBottom == null) {
            throw new NullValueException("marginBottom can not be null");
        }
        setCssValue(marginBottom.getCssValue());
    }

    /**
     * @param percent
     *            the percentage value to set. The cssLengthUnit will
     *            automatically set to %.
     * @since 1.0.0
     * @author WFF
     */
    public MarginBottom(final float percent) {
        cssLengthUnit = CssLengthUnit.PER;
        value = percent;
        cssValue = String.valueOf(percent) + cssLengthUnit;
    }

    /**
     * @param value
     * @param cssLengthUnit
     */
    public MarginBottom(final float value, final CssLengthUnit cssLengthUnit) {
        this.value = value;
        this.cssLengthUnit = cssLengthUnit;
        cssValue = String.valueOf(value) + cssLengthUnit;
    }

    /**
     * @param value<commit_msg>Possible optimization<commit_after>/*
 * Copyright 2014-2017 Web Firm Framework
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * @author WFF
 */
package com.webfirmframework.wffweb.css;

import java.util.Arrays;
import java.util.List;

import com.webfirmframework.wffweb.InvalidValueException;
import com.webfirmframework.wffweb.NullValueException;
import com.webfirmframework.wffweb.css.core.AbstractCssProperty;

/**
 * <pre>
 * The margin-bottom property sets the bottom margin of an element.
 *
 * Note: Negative values are allowed.
 * Default value:  0
 * Inherited:      no
 * Animatable:     yes
 * Version:        CSS1
 * JavaScript syntax:      object.style.marginBottom="100px"
 * </pre>
 *
 * @author WFF
 * @since 1.0.0
 */
public class MarginBottom extends AbstractCssProperty<MarginBottom> {

    private static final long serialVersionUID = 1_0_0L;

    public static final String INITIAL = "initial";
    public static final String INHERIT = "inherit";
    public static final String AUTO = "auto";

    private static final List<String> PREDEFINED_CONSTANTS = Arrays
            .asList(INITIAL, INHERIT, AUTO);

    private String cssValue;
    private Float value;
    private CssLengthUnit cssLengthUnit;

    /**
     * The {@code auto} will be set as the value
     */
    public MarginBottom() {
        setCssValue("0px");
    }

    /**
     * @param cssValue
     *            the css value to set.
     */
    public MarginBottom(final String cssValue) {
        setCssValue(cssValue);
    }

    /**
     * @param widthtCss
     *            the {@code MarginBottom} object from which the cssValue to
     *            set.And, {@code null} will throw {@code NullValueException}
     */
    public MarginBottom(final MarginBottom marginBottom) {
        if (marginBottom == null) {
            throw new NullValueException("marginBottom can not be null");
        }
        setCssValue(marginBottom.getCssValue());
    }

    /**
     * @param percent
     *            the percentage value to set. The cssLengthUnit will
     *            automatically set to %.
     * @since 1.0.0
     * @author WFF
     */
    public MarginBottom(final float percent) {
        cssLengthUnit = CssLengthUnit.PER;
        value = percent;
        cssValue = String.valueOf(percent).concat(cssLengthUnit.toString());
    }

    /**
     * @param value
     * @param cssLengthUnit
     */
    public MarginBottom(final float value, final CssLengthUnit cssLengthUnit) {
        this.value = value;
        this.cssLengthUnit = cssLengthUnit;
        cssValue = String.valueOf(value).concat(cssLengthUnit.toString());
    }

    /**
     * @param value
{'fraction_non_alphanumeric': 0.09036144578313253, 'fraction_numerical': 0.008560558021559923, 'mean_word_length': 2.672293364377183, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '830672', 'n_tokens_mistral': 1812, 'n_tokens_neox': 1770, 'n_words': 564}