<commit_before>// LayoutModules
// Written in 2015 by <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all copyright and
// related and neighboring rights to this software to the public domain worldwide.
// This software is distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with
// this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

import UIKit

/// A collection view layout which uses `LayoutModuleType` values to create its layout.
public final class LayoutModulesCollectionViewLayout: UICollectionViewLayout
{
    // MARK: - Initialization
    
    /**
    Initializes a `LayoutModulesCollectionViewLayout`.
    
    - parameter moduleForSection: A function to determine the layout module for each section.
    */
    public convenience init(majorAxis: Axis, moduleForSection: (section: Int) -> LayoutModuleType)
    {
        self.init()
        self.majorAxis = majorAxis
        self.moduleForSection = moduleForSection
    }

    // MARK: - Major Axis

    /// The major (scrolling) axis for the layout. By default, this is `Vertical`.
    public var majorAxis = Axis.Vertical
    
    // MARK: - Modules
    
    /// A function to determine the layout module for each section.
    ///
    /// This property should be assigned a value by clients before performing layout.
    public var moduleForSection: ((section: Int) -> LayoutModuleType)?
    
    // MARK: - Layout Implementation
    
    /// Prepares the layout.
    ///
    /// This function is an implementation detail of `UICollectionViewLayout`, and should not be called by clients.
    public override func prepareLayout()
    {
        if let collectionView = self.collectionView
        {
            let minorDimension: CGFloat

            switch majorAxis
            {
            case .Horizontal:
                minorDimension = collectionView.bounds.size.height
            case .Vertical:
                minorDimension = collectionView.bounds.size.width
            }

            var origin = Point(major: 0, minor: 0)<commit_msg>Invalidate layout when properties change.<commit_after>// LayoutModules
// Written in 2015 by <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all copyright and
// related and neighboring rights to this software to the public domain worldwide.
// This software is distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with
// this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

import UIKit

/// A collection view layout which uses `LayoutModuleType` values to create its layout.
public final class LayoutModulesCollectionViewLayout: UICollectionViewLayout
{
    // MARK: - Initialization
    
    /**
    Initializes a `LayoutModulesCollectionViewLayout`.
    
    - parameter moduleForSection: A function to determine the layout module for each section.
    */
    public convenience init(majorAxis: Axis, moduleForSection: (section: Int) -> LayoutModuleType)
    {
        self.init()
        self.majorAxis = majorAxis
        self.moduleForSection = moduleForSection
    }

    // MARK: - Major Axis

    /// The major (scrolling) axis for the layout. By default, this is `Vertical`.
    public var majorAxis = Axis.Vertical
    {
        didSet { invalidateLayout() }
    }
    
    // MARK: - Modules
    
    /// A function to determine the layout module for each section.
    ///
    /// This property should be assigned a value by clients before performing layout.
    public var moduleForSection: ((section: Int) -> LayoutModuleType)?
    {
        didSet { invalidateLayout() }
    }
    
    // MARK: - Layout Implementation
    
    /// Prepares the layout.
    ///
    /// This function is an implementation detail of `UICollectionViewLayout`, and should not be called by clients.
    public override func prepareLayout()
    {
        if let collectionView = self.collectionView
        {
            let minorDimension: CGFloat

            switch majorAxis
            {
            case .Horizontal:
                minorDimension = collectionView.bounds.size.height
            case .Vertical:
                minorDimension = collectionView.bounds.size.width
            }

            var origin = Point(major: 0, minor: 0)
{'fraction_non_alphanumeric': 0.08133212505663796, 'fraction_numerical': 0.0040779338468509285, 'mean_word_length': 2.4171826625387, 'pattern_counts': {'":': 0, '<': 11, '<?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': '5320587', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1084, 'n_words': 419}