<commit_before>
//
//  URBNValidationRulesCompat.swift
//  Pods
//
//  Created by <NAME> on 12/21/15.
//
//

import Foundation

@objc public protocol URBNCompatValidationRule {
    var localizationKey: String { get set }
    func validateValue(value: AnyObject?) -> Bool
    func validateValue(value: AnyObject?, key: String) -> Bool
}

@objc public class URBNCompatBaseRule: NSObject, URBNCompatValidationRule {
    var backingRule: URBNBaseRule
    
    public init(localizationKey: String? = nil) {
        backingRule = URBNBaseRule(localizationKey: localizationKey)
        super.init()
    }
    
    public func validateValue(value: AnyObject?) -> Bool { return backingRule.validateValue(value) }
    
    public func validateValue(value: AnyObject?, key: String) -> Bool { return backingRule.validateValue(value, key: key) }
    
    public var localizationKey: String  {
        get {
            return backingRule.localizationKey
        }
        set {
            backingRule.localizationKey = newValue
        }
    }
}

@objc public class URBNCompatRequirementRule: URBNCompatBaseRule, URBNRequirement {
    public var isRequired: Bool {
        get {
            if let requiredBaseRule = backingRule as? URBNRegexRule {
                return requiredBaseRule.isRequired
            }
            
            return false
        }
        set {
            if let requiredBaseRule = backingRule as? URBNRegexRule {
                requiredBaseRule.isRequired = newValue
            }
        }
    }
}

@objc public class URBNCompatRegexRule: URBNCompatRequirementRule {
    public init(pattern: String, localizationKey: String? = nil) {
        super.init()
        backingRule = URBNRegexRule(pattern: pattern, localizationKey: localizationKey)
    }<commit_msg>fix requirement type checking<commit_after>
//
//  URBNValidationRulesCompat.swift
//  Pods
//
//  Created by <NAME> on 12/21/15.
//
//

import Foundation

@objc public protocol URBNCompatValidationRule {
    var localizationKey: String { get set }
    func validateValue(value: AnyObject?) -> Bool
    func validateValue(value: AnyObject?, key: String) -> Bool
}

@objc public class URBNCompatBaseRule: NSObject, URBNCompatValidationRule {
    var backingRule: URBNBaseRule
    
    public init(localizationKey: String? = nil) {
        backingRule = URBNBaseRule(localizationKey: localizationKey)
        super.init()
    }
    
    public func validateValue(value: AnyObject?) -> Bool { return backingRule.validateValue(value) }
    
    public func validateValue(value: AnyObject?, key: String) -> Bool { return backingRule.validateValue(value, key: key) }
    
    public var localizationKey: String  {
        get {
            return backingRule.localizationKey
        }
        set {
            backingRule.localizationKey = newValue
        }
    }
}

@objc public class URBNCompatRequirementRule: URBNCompatBaseRule, URBNRequirement {
    public var isRequired: Bool {
        get {
            if let requiredBaseRule = backingRule as? URBNRequirement {
                return requiredBaseRule.isRequired
            }
            
            return false
        }
        set {
            if var requiredBaseRule = backingRule as? URBNRequirement {
                requiredBaseRule.isRequired = newValue
            }
        }
    }
}

@objc public class URBNCompatRegexRule: URBNCompatRequirementRule {
    public init(pattern: String, localizationKey: String? = nil) {
        super.init()
        backingRule = URBNRegexRule(pattern: pattern, localizationKey: localizationKey)
    }
{'fraction_non_alphanumeric': 0.07975460122699386, 'fraction_numerical': 0.0033463469046291134, 'mean_word_length': 2.4892996108949417, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4218410', 'n_tokens_mistral': 1028, 'n_tokens_neox': 968, 'n_words': 245}