<commit_before>//
//  BNRHypnosisView.swift
//  Hypnosister
//
//  Created by <NAME> on 7/5/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import UIKit

class BNRHypnosisView: UIView {
    var circleColor: UIColor = UIColor.lightGrayColor() {
        didSet { // didSet replaces the need for writing a custom setCircleColor (in obj-c)
            self.setNeedsDisplay()
        }
    }
    
    init(frame: CGRect) {
        super.init(frame: frame)
        // All BNRHypnosisViews start with a clear background color
        self.backgroundColor = UIColor.clearColor()
    }
    
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func drawRect(rect: CGRect) {
        let bounds = self.bounds
        
        // Figure out the center of the bounds rectangle
        var center = CGPoint()
        center.x = bounds.origin.x + bounds.size.width / 2.0
        center.y = bounds.origin.y + bounds.size.height / 2.0
        
        // The largest circle will circumscribe the view
        var maxRadius = hypotf(bounds.size.width, bounds.size.height) / 2.0
        
        let path = UIBezierPath()
        
        for var currentRadius = maxRadius; currentRadius > 0; currentRadius -= 20 {
            path.moveToPoint(CGPointMake(center.x + currentRadius, center.y))
            
            path.addArcWithCenter(center, radius: currentRadius, startAngle: 0.0, endAngle: Float(M_PI) * 2.0, clockwise: true)
        }
        
        // Configure line width to 10 points
        path.lineWidth = 10
        
        // Configure the drawing color
        self.circleColor.setStroke()
        
        // Draw the line!
        path.stroke()
    }
    
    override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) {
        print("Touch began on \(self)")
        
        // Get 3 random numbers between 0 and 1
        func randomNumber() -> Float { return Float(arc4random() % 100) / 100.0 }
        let red = randomNumber()
        let green = randomNumber()
        let blue = randomNumber()
        
        let randomColor = UIColor(red: red, green: green, blue: blue, alpha: 1.0)
        // UIColor.colorWithRed "is unavailable: use object
        //construction 'UIColor(red:green:blue:alpha:)'"
        
        self.circleColor = randomColor
    }
}
<commit_msg>Updating with beta 3 changes<commit_after>//
//  BNRHypnosisView.swift
//  Hypnosister
//
//  Created by <NAME> on 7/5/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import UIKit

class BNRHypnosisView: UIView {
    var circleColor: UIColor = UIColor.lightGrayColor() {
        didSet { // didSet replaces the need for writing a custom setCircleColor (in obj-c)
            self.setNeedsDisplay()
        }
    }
    
    init(frame: CGRect) {
        super.init(frame: frame)
        // All BNRHypnosisViews start with a clear background color
        self.backgroundColor = UIColor.clearColor()
    }
    
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func drawRect(rect: CGRect) {
        let bounds = self.bounds
        
        // Figure out the center of the bounds rectangle
        var center = CGPoint()
        center.x = bounds.origin.x + bounds.size.width / 2.0
        center.y = bounds.origin.y + bounds.size.height / 2.0
        
        // The largest circle will circumscribe the view
        var maxRadius = hypotf(Float(bounds.size.width), Float(bounds.size.height)) / 2.0
        
        let path = UIBezierPath()
        
        for var currentRadius = maxRadius; currentRadius > 0; currentRadius -= 20 {
            // Have to cast to CGFloat in Swift a lot to work with Cocoa libraries
            path.moveToPoint(CGPointMake(center.x + CGFloat(currentRadius), center.y))
            
            path.addArcWithCenter(center, radius: CGFloat(currentRadius), startAngle: 0.0, endAngle: CGFloat(M_PI) * 2.0, clockwise: true)
        }
        
        // Configure line width to 10 points
        path.lineWidth = 10
        
        // Configure the drawing color
        self.circleColor.setStroke()
        
        // Draw the line!
        path.stroke()
    }
    
    override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) {
        print("Touch began on \(self)")
        
        // Get 3 random numbers between 0 and 1
        func randomNumber() -> Float { return Float(arc4random() % 100) / 100.0 }
        let red = randomNumber()
        let green = randomNumber()
        let blue = randomNumber()
        
        let randomColor = UIColor(red: CGFloat(red), green: CGFloat(green), blue: CGFloat(blue), alpha: 1.0)
        // UIColor.colorWithRed "is unavailable: use object
        //construction 'UIColor(red:green:blue:alpha:)'"
        
        self.circleColor = randomColor
    }
}

{'fraction_non_alphanumeric': 0.09772772974059923, 'fraction_numerical': 0.015483611502111402, 'mean_word_length': 2.047794117647059, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6274045', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1419, 'n_words': 418}