<commit_before>//
//  FDDBaseTableViewCell.swift
//  FDDUITableViewDemo
//
//  Created by denglibing on 2017/2/7.
//  Copyright © 2017年 denglibing. All rights reserved.
//

import UIKit

@objc
protocol FDDBaseTableViewCellDelegate: NSObjectProtocol {
    @objc optional func fddTableViewCell(cell: FDDBaseTableViewCell, object: AnyObject?)
}


enum FDDBaseTableViewCellType {
    case FDDBaseTableViewCellNone       //上下线都隐藏
    case FDDBaseTableViewCellAtFirst    //下线隐藏,按照group样式即第一个cell,originx=0
    case FDDBaseTableViewCellAtMiddle   //下线隐藏,按照group样式即中间cell,originx=separateLineOffset
    case FDDBaseTableViewCellAtLast     //上下线都显示,按照group样式即最后一个cell,上线originx=separateLineOffset 下线originx=0
    case FDDBaseTableViewCellNormal     //下线隐藏,按照plain样式,originx=separateLineOffset
    case FDDBaseTableViewCellSingle     //上下线都显示，originx=0
}

class FDDBaseTableViewCell: UITableViewCell {
    
    weak var fddDelegate: FDDBaseTableViewCellDelegate?
    var fddIndexPath: IndexPath?
    var fddCellData: AnyObject?
    var separateLineOffset: CGFloat = 0.0
    var sizeOnePx: CGFloat = 1.0 / UIScreen.main.scale
    
    var _cellType: FDDBaseTableViewCellType = .FDDBaseTableViewCellNormal
    var cellType: FDDBaseTableViewCellType {
        get {
            return _cellType
        }
        set {
            _cellType = newValue
            
            switch _cellType {
            case .FDDBaseTableViewCellNone:
                topLineView.isHidden = true
                bottomLineView.isHidden = true
                break
                
            case .FDDBaseTableViewCellAtFirst, .FDDBaseTableViewCellAtMiddle, .FDDBaseTableViewCellNormal:
                topLineView.isHidden = false
                bottomLineView.isHidden = true
                break
                
            case .FDDBaseTableViewCellAtLast, .FDDBaseTableViewCellSingle:
                topLineView.isHidden = false
                bottomLineView.isHidden = false
                break
            }
            
            self.setNeedsLayout()
        }
    }
    
    
    class func cellHeight(_ data: AnyObject?, boundWidth: Float) -> Float {
        return 44.0
    }
    
    
    // MARK: - public func
    func setBorderLine(backgroundColor: UIColor) {
        topLineView.backgroundColor = backgroundColor
        bottomLineView.backgroundColor = backgroundColor
    }
    
    func setCellData(_ data: AnyObject?) {
        self.setCellData(data, delegate: nil)
        print("子类实现")
    }
    
    func setCellData(_ data: AnyObject?, delegate: FDDBaseTableViewCellDelegate?) {
        fddCellData = data
        fddDelegate = delegate
        print("子类实现")<commit_msg>小代码改动<commit_after>//
//  FDDBaseTableViewCell.swift
//  FDDUITableViewDemo
//
//  Created by denglibing on 2017/2/7.
//  Copyright © 2017年 denglibing. All rights reserved.
//

import UIKit

@objc
protocol FDDBaseTableViewCellDelegate: NSObjectProtocol {
    @objc optional func fddTableViewCell(cell: FDDBaseTableViewCell, object: AnyObject?)
}


enum FDDBaseTableViewCellType {
    case FDDBaseTableViewCellNone       //上下线都隐藏
    case FDDBaseTableViewCellAtFirst    //下线隐藏,按照group样式即第一个cell,originx=0
    case FDDBaseTableViewCellAtMiddle   //下线隐藏,按照group样式即中间cell,originx=separateLineOffset
    case FDDBaseTableViewCellAtLast     //上下线都显示,按照group样式即最后一个cell,上线originx=separateLineOffset 下线originx=0
    case FDDBaseTableViewCellNormal     //下线隐藏,按照plain样式,originx=separateLineOffset
    case FDDBaseTableViewCellSingle     //上下线都显示，originx=0
}

class FDDBaseTableViewCell: UITableViewCell {
    
    weak var fddDelegate: FDDBaseTableViewCellDelegate?
    var fddIndexPath: IndexPath?
    var fddCellData: AnyObject?
    var separateLineOffset: CGFloat = 0.0
    var sizeOnePx: CGFloat = 1.0 / UIScreen.main.scale
    
    var _cellType: FDDBaseTableViewCellType = .FDDBaseTableViewCellNormal
    var cellType: FDDBaseTableViewCellType {
        get {
            return _cellType
        }
        set {
            _cellType = newValue
            
            switch _cellType {
            case .FDDBaseTableViewCellNone:
                topLineView.isHidden = true
                bottomLineView.isHidden = true
                break
                
            case .FDDBaseTableViewCellAtFirst, .FDDBaseTableViewCellAtMiddle, .FDDBaseTableViewCellNormal:
                topLineView.isHidden = false
                bottomLineView.isHidden = true
                break
                
            case .FDDBaseTableViewCellAtLast, .FDDBaseTableViewCellSingle:
                topLineView.isHidden = false
                bottomLineView.isHidden = false
                break
            }
            
            self.setNeedsLayout()
        }
    }
    
    class func cellHeight(_ data: AnyObject?) -> Float {
        return self.cellHeight(data, boundWidth: Float(UIScreen.main.bounds.size.width))
    }
    
    class func cellHeight(_ data: AnyObject?, boundWidth: Float) -> Float {
        return 44.0
    }
    
    
    // MARK: - public func
    func setBorderLine(backgroundColor: UIColor) {
        topLineView.backgroundColor = backgroundColor
        bottomLineView.backgroundColor = backgroundColor
    }
    
    func setCellData(_ data: AnyObject?) {
        self.setCellData(data, delegate: nil)
        print("子类实现")
    }
    
    func setCellData(_ data: AnyObject?, delegate: FDDBaseTableViewCellDelegate?) {
        fddCellData = data
        fddDelegate = delegate
        print("子类实现")
{'fraction_non_alphanumeric': 0.06665455866327642, 'fraction_numerical': 0.00726480203414457, 'mean_word_length': 2.317469879518072, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '4660121', 'n_tokens_mistral': 1766, 'n_tokens_neox': 1745, 'n_words': 309}