<commit_before>//
//  Padding.swift
//  SwiftyEcharts
//
//  Created by <NAME> on 12/04/2017.
//  Copyright © 2017 com.pluto-y. All rights reserved.
//

/// 内边距
///
/// - all: 所有
/// - verticalAndHorizontal: 垂直和水平方向
/// - trbl: 上右下左
public enum Padding: Jsonable, CustomStringConvertible {
    case all(Float)
    case verticalAndHorizontal(Float, Float)
    case trbl(Float, Float, Float, Float)
    public var description: String {
        switch self {
        case let .all(val):
            return "\(val)"
        case let .verticalAndHorizontal(vVal, hVal):
            return "[\(vVal), \(hVal)]"
        case let .trbl(tVal, rVal, bVal, lVal):
            return "[\(tVal), \(rVal), \(bVal), \(lVal)]"
        }
    }
}
<commit_msg>feature(model): Make extension for `Padding` which can make it create by `Float`, `Int` and `Array`<commit_after>//
//  Padding.swift
//  SwiftyEcharts
//
//  Created by <NAME> on 12/04/2017.
//  Copyright © 2017 com.pluto-y. All rights reserved.
//

/// 内边距
///
/// - all: 所有
/// - verticalAndHorizontal: 垂直和水平方向
/// - trbl: 上右下左
/// - null: 为空的情况
public enum Padding: Jsonable {
    case all(Float)
    case verticalAndHorizontal(Float, Float)
    case trbl(Float, Float, Float, Float)
    case null
    public var jsonString: String {
        switch self {
        case let .all(val):
            return "\(val)".jsonString
        case let .verticalAndHorizontal(vVal, hVal):
            return "[\(vVal), \(hVal)]".jsonString
        case let .trbl(tVal, rVal, bVal, lVal):
            return "[\(tVal), \(rVal), \(bVal), \(lVal)]".jsonString
        case .null:
            return "null"
        }
    }
}


// MARK: - 使其能通过浮点数，整数来创建创建
extension Padding: FloatLiteralConvertible {
    public init(floatLiteral value: Float) {
        self = .all(value)
    }
}

extension Padding: IntegerLiteralConvertible {
    public init(integerLiteral value: Int) {
        self = .all(Float(value))
    }
}

// MARK: - 使其能通过数组来创建
extension Padding: ArrayLiteralConvertible {
    public init(arrayLiteral elements: Float...) {
        if elements.count == 1 {
            self = .all(elements.first!)
        } else if elements.count == 2 {
            self = .verticalAndHorizontal(elements.first!, elements.last!)
        } else if elements.count == 4 {
            self = .trbl(elements[0], elements[1], elements[2], elements[3])
        } else {
            self = .null
        }
    }
}

{'fraction_non_alphanumeric': 0.14662273476112025, 'fraction_numerical': 0.012767710049423394, 'mean_word_length': 2.1586475942782837, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5614516', 'n_tokens_mistral': 842, 'n_tokens_neox': 824, 'n_words': 206}