<commit_before>//
//  FilterChain.swift
//  LightRoom
//
//  Created by <NAME> on 2/22/16.
//  Copyright © 2016 muukii. All rights reserved.
//

import Foundation

infix operator ~~> { associativity left }
public func ~~> (chain1: FilterChain, chain2: FilterChain) -> FilterChain {
    let components = chain1.filterComponents + chain2.filterComponents
    return FilterChain(filterComponents: components)
}


public class FilterChain {
    
    public private(set) var filterComponents: [FilterComponent] = [] {
        didSet {
            self.connectFilters()
        }
    }
    
    public func addFilterComponent(filterComponent: FilterComponent) {
        self.filterComponents.append(filterComponent)
    }
    
    public var inputImage: CIImage? {
        didSet {
            
            self.connectFilters()
        }
    }
    
    public var outputImage: CIImage? {
        guard self.inputImage != nil else {
            return nil
        }
        return self.filterComponents.last?.outputImage
    }
    
    public init() {
        
    }
    
    public init(filterComponent: FilterComponent) {
        self.filterComponents = [filterComponent]
    }
    
    public init(filterComponents: [FilterComponent]) {
        self.filterComponents = filterComponents
    }
    
    private func connectFilters() {
        
        guard let inputImage = self.inputImage else { return }
        
        self.filterComponents.first?.inputImage = inputImage<commit_msg>wip :D<commit_after>//
//  FilterChain.swift
//  LightRoom
//
//  Created by <NAME> on 2/22/16.
//  Copyright © 2016 muukii. All rights reserved.
//

import Foundation

infix operator ~~> { associativity left }
public func ~~> (chain1: FilterChain, chain2: FilterChain) -> FilterChain {
    let components = chain1.filterComponents + chain2.filterComponents
    return FilterChain(filterComponents: components)
}


public class FilterChain {
    
    public private(set) var filterComponents: [FilterComponentType] = [] {
        didSet {
            self.connectFilters()
        }
    }
    
    public func addFilterComponent(filterComponent: FilterComponentType) {
        self.filterComponents.append(filterComponent)
    }
    
    public var inputImage: CIImage? {
        didSet {
            
            self.connectFilters()
        }
    }
    
    public var outputImage: CIImage? {
        guard self.inputImage != nil else {
            return nil
        }
        return self.filterComponents.last?.outputImage
    }
    
    public init() {
        
    }
    
    public init(filterComponent: FilterComponentType) {
        self.filterComponents = [filterComponent]
    }
    
    public init(filterComponents: [FilterComponentType]) {
        self.filterComponents = filterComponents
    }
    
    private func connectFilters() {
        
        guard let inputImage = self.inputImage else { return }
        
        self.filterComponents.first?.inputImage = inputImage
{'fraction_non_alphanumeric': 0.08840336134453781, 'fraction_numerical': 0.008739495798319327, 'mean_word_length': 2.220779220779221, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3812374', 'n_tokens_mistral': 806, 'n_tokens_neox': 793, 'n_words': 182}