<commit_before>//
//  CircleProgressView.swift
//
//
//  Created by <NAME> on 8/11/14.
//  Copyright (c) 2014 <NAME>, Cardinal Solutions Group. All rights reserved.
//

import UIKit
import QuartzCore

@IBDesignable

@objc class CircleProgressView: UIView {

    internal struct Constants {
        static let circleDegress = 360.0
        static let minimumValue = 0.000001
        static let maximumValue = 0.999999
        static let ninetyDegrees = 90.0
        static let twoSeventyDegrees = 270.0
        static var contentView:UIView = UIView()
        static var contentContainer:UIView = UIView()
    }
    
    @IBInspectable var progress: Double = Constants.minimumValue {
        didSet { setNeedsDisplay() }
    }

    @IBInspectable var clockwise: Bool = true {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackWidth: CGFloat = 10 {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackImage: UIImage? {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackBackgroundColor: UIColor = UIColor.grayColor() {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackFillColor: UIColor = UIColor.blueColor() {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackBoarderColor:UIColor = UIColor.clearColor() {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackBoarderWidth: CGFloat = 0 {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var centerFillColor: UIColor = UIColor.whiteColor() {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var contentView: UIView {
        return Constants.contentView
    }

    required override init(frame: CGRect) {
        super.init(frame: frame)
        self.addSubview(contentView)
    }
    
    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.addSubview(contentView)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        self.addSubview(contentView)
    }
    
    override func drawRect(var rect: CGRect) {
        
        let innerRect = CGRectInset(rect, trackBoarderWidth, trackBoarderWidth)
    
        progress = (progress/1.0) == 0.0 ? Constants.minimumValue : progress
        progress = (progress/1.0) == 1.0 ? Constants.maximumValue : progress
        progress = clockwise ? (-Constants.twoSeventyDegrees + ((1.0 - progress) * Constants.circleDegress)) : (Constants.ninetyDegrees - ((1.0 - progress) * Constants.circleDegress))
        
        let context = UIGraphicsGetCurrentContext()
        
        // background Drawing
        trackBackgroundColor.setFill()
        let circlePath = UIBezierPath(ovalInRect: CGRectMake(innerRect.minX, innerRect.minY, CGRectGetWidth(innerRect), CGRectGetHeight(innerRect)))
        circlePath.fill();
        
        if trackBoarderWidth > 0 {<commit_msg>Updated to call super.<commit_after>//
//  CircleProgressView.swift
//
//
//  Created by <NAME> on 8/11/14.
//  Copyright (c) 2014 <NAME>, Cardinal Solutions Group. All rights reserved.
//

import UIKit
import QuartzCore

@IBDesignable

@objc class CircleProgressView: UIView {

    internal struct Constants {
        static let circleDegress = 360.0
        static let minimumValue = 0.000001
        static let maximumValue = 0.999999
        static let ninetyDegrees = 90.0
        static let twoSeventyDegrees = 270.0
        static var contentView:UIView = UIView()
        static var contentContainer:UIView = UIView()
    }
    
    @IBInspectable var progress: Double = Constants.minimumValue {
        didSet { setNeedsDisplay() }
    }

    @IBInspectable var clockwise: Bool = true {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackWidth: CGFloat = 10 {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackImage: UIImage? {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackBackgroundColor: UIColor = UIColor.grayColor() {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackFillColor: UIColor = UIColor.blueColor() {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackBoarderColor:UIColor = UIColor.clearColor() {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var trackBoarderWidth: CGFloat = 0 {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var centerFillColor: UIColor = UIColor.whiteColor() {
        didSet { setNeedsDisplay() }
    }
    
    @IBInspectable var contentView: UIView {
        return Constants.contentView
    }

    required override init(frame: CGRect) {
        super.init(frame: frame)
        self.addSubview(contentView)
    }
    
    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.addSubview(contentView)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        self.addSubview(contentView)
    }
    
    override func drawRect(var rect: CGRect) {
        
        super.drawRect(rect)
        
        let innerRect = CGRectInset(rect, trackBoarderWidth, trackBoarderWidth)
    
        progress = (progress/1.0) == 0.0 ? Constants.minimumValue : progress
        progress = (progress/1.0) == 1.0 ? Constants.maximumValue : progress
        progress = clockwise ? (-Constants.twoSeventyDegrees + ((1.0 - progress) * Constants.circleDegress)) : (Constants.ninetyDegrees - ((1.0 - progress) * Constants.circleDegress))
        
        let context = UIGraphicsGetCurrentContext()
        
        // background Drawing
        trackBackgroundColor.setFill()
        let circlePath = UIBezierPath(ovalInRect: CGRectMake(innerRect.minX, innerRect.minY, CGRectGetWidth(innerRect), CGRectGetHeight(innerRect)))
        circlePath.fill();
        
        if trackBoarderWidth > 0 {
{'fraction_non_alphanumeric': 0.09429787234042553, 'fraction_numerical': 0.01702127659574468, 'mean_word_length': 2.481042654028436, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '4107435', 'n_tokens_mistral': 1883, 'n_tokens_neox': 1782, 'n_words': 384}