<commit_before>//
//  KZTableViewCell.swift
//  KZ
//
//  Created by <NAME> on 1/25/16.
//  Copyright © 2016 Storm Edge Apps LLC. All rights reserved.
//

import UIKit
import PureLayout
import Reusable

public class KZTableViewCell: UITableViewCell, Reusable {
    public let topSeperator = UIView()
    public let bottomSeperator = UIView()
    
    var didSetupConstraints = false
    var trailingDetailConstraint = NSLayoutConstraint()
    public var model: Any?
    
    override required public init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.backgroundColor = UIColor.clearColor()

        self.contentView.addSubview(topSeperator)
        self.contentView.addSubview(bottomSeperator)
        
        self.contentView.bounds.size.height = 99999
    }
    
    //MARK: Setup Constraints
    override public func updateConstraints() {
        super.updateConstraints()
        if didSetupConstraints {
            return
        }
        
        bottomSeperator.autoSetDimension(.Height, toSize: (1.0/UIScreen.mainScreen().scale))
        bottomSeperator.autoPinEdgeToSuperviewEdge(.Bottom)
        bottomSeperator.autoPinEdgeToSuperviewEdge(.Left)
        bottomSeperator.autoPinEdgeToSuperviewEdge(.Right)
        
        topSeperator.autoSetDimension(.Height, toSize: (1.0/UIScreen.mainScreen().scale))
        topSeperator.autoPinEdgeToSuperviewEdge(.Top)
        topSeperator.autoPinEdgeToSuperviewEdge(.Left)
        topSeperator.autoPinEdgeToSuperviewEdge(.Right)
        
        didSetupConstraints = true
    }
    
    public func getHeight() -> CGFloat {
        self.contentView.bounds.size.height = 99999
        self.setNeedsUpdateConstraints()
        self.updateConstraints()
        
        self.bounds.size.width = UIScreen.mainScreen().bounds.size.width
        
        self.setNeedsLayout()
        self.layoutIfNeeded()
        
        let height = self.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height
        return height + CGFloat(1.0)
    }
    
    public func setIndexPath(indexPath: NSIndexPath, last: Bool) {
        if indexPath.row == 0 {
            topSeperator.alpha = 0.0
        } else {
            topSeperator.alpha = 1.0
        }
    }
    
    public func setContent(content: Any) {
        model = content
        
        fillInCellData()
    }
    
    public func fillInCellData() {
        
    }
    
    required public init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }<commit_msg>set model = nil on cell reuse<commit_after>//
//  KZTableViewCell.swift
//  KZ
//
//  Created by <NAME> on 1/25/16.
//  Copyright © 2016 Storm Edge Apps LLC. All rights reserved.
//

import UIKit
import PureLayout
import Reusable

public class KZTableViewCell: UITableViewCell, Reusable {
    public let topSeperator = UIView()
    public let bottomSeperator = UIView()
    
    var didSetupConstraints = false
    var trailingDetailConstraint = NSLayoutConstraint()
    public var model: Any?
    
    override required public init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.backgroundColor = UIColor.clearColor()

        self.contentView.addSubview(topSeperator)
        self.contentView.addSubview(bottomSeperator)
        
        self.contentView.bounds.size.height = 99999
    }
    
    //MARK: Setup Constraints
    override public func updateConstraints() {
        super.updateConstraints()
        if didSetupConstraints {
            return
        }
        
        bottomSeperator.autoSetDimension(.Height, toSize: (1.0/UIScreen.mainScreen().scale))
        bottomSeperator.autoPinEdgeToSuperviewEdge(.Bottom)
        bottomSeperator.autoPinEdgeToSuperviewEdge(.Left)
        bottomSeperator.autoPinEdgeToSuperviewEdge(.Right)
        
        topSeperator.autoSetDimension(.Height, toSize: (1.0/UIScreen.mainScreen().scale))
        topSeperator.autoPinEdgeToSuperviewEdge(.Top)
        topSeperator.autoPinEdgeToSuperviewEdge(.Left)
        topSeperator.autoPinEdgeToSuperviewEdge(.Right)
        
        didSetupConstraints = true
    }
    
    public func getHeight() -> CGFloat {
        self.contentView.bounds.size.height = 99999
        self.setNeedsUpdateConstraints()
        self.updateConstraints()
        
        self.bounds.size.width = UIScreen.mainScreen().bounds.size.width
        
        self.setNeedsLayout()
        self.layoutIfNeeded()
        
        let height = self.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height
        return height + CGFloat(1.0)
    }
    
    public func setIndexPath(indexPath: NSIndexPath, last: Bool) {
        if indexPath.row == 0 {
            topSeperator.alpha = 0.0
        } else {
            topSeperator.alpha = 1.0
        }
    }
    
    public func setContent(content: Any) {
        model = content
        
        fillInCellData()
    }
    
    public func fillInCellData() {
        
    }
    
    override public func prepareForReuse() {
        super.prepareForReuse()
        
        model = nil
    }
    
    required public init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
{'fraction_non_alphanumeric': 0.08595935110945366, 'fraction_numerical': 0.011187768040275966, 'mean_word_length': 2.4122137404580153, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5251841', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1539, 'n_words': 294}