<commit_before>//
//  RouteSummaryObject.swift
//  TCAT
//
//  Created by <NAME> on 9/10/17.
//  Copyright © 2017 cuappdev. All rights reserved.
//

import UIKit
import TRON
import SwiftyJSON
import CoreLocation

enum PinType: String {
    case stop, place
}

enum NextDirection: String {
    case bus, walk
}

class RouteSummaryObject: NSObject, JSONDecodable {

    var name: String
    var type: PinType
    var busNumber: Int?
    var nextDirection: NextDirection?
    
    var location: CLLocationCoordinate2D
    var time: Date
    
    override var description: String {
        return """
        {
            name: \(name),
            type: \(type.rawValue),
            busNumber: \(busNumber ?? -1),
            nextDirection: \(nextDirection?.rawValue ?? "nil")
        }
        """
    }
    
    init(direction: Direction) {
        name = direction.name
        type = direction.type == .walk ? PinType.place : PinType.stop
        busNumber = direction.routeNumber
        nextDirection = direction.type == .depart ? NextDirection.bus: NextDirection.walk
        
        // N2SELF - delete this later b/c just filler code so it compiles
        location = CLLocationCoordinate2D()
        time = Date()
    }
    
    required init(json: JSON) throws {
        name = json["start"]["name"].stringValue
        type = .stop
        
        if(json["busPath"] != JSON.null){
            nextDirection = .bus
            busNumber = json["busPath"]["lineNumber"].intValue
        }else{
            nextDirection = .walk
        }
        
        let long = json["start"]["location"]["longitude"].doubleValue
        let lat = json["start"]["location"]["latitude"].doubleValue
        location = CLLocationCoordinate2D(latitude: lat, longitude: long)
        
        time = Date(timeIntervalSince1970: json["startTime"].doubleValue)
    }
    
    init(name: String, type: PinType, location: CLLocationCoordinate2D, time: Date) {
        self.name = name
        self.type = type
        self.location = location
        self.time = time
    }
    
    convenience init(name: String, type: PinType, location: CLLocationCoordinate2D, time: Date, nextDirection: NextDirection) {
        self.init(name: name, type: type, location: location, time: time)
        self.nextDirection = nextDirection
    }
    
    convenience init(name: String, type: PinType, location: CLLocationCoordinate2D, time: Date, nextDirection: NextDirection, busNumber: Int) {
        self.init(name: name, type: type, location: location, time: time, nextDirection: nextDirection)
        self.busNumber = busNumber
    }
    
    func updateName(from place: Place) {
        name = place.name
    }
    
    func removeNextDirection() {
        nextDirection = nil
    }
}<commit_msg>Delete time and location properties from RouteSummaryObject<commit_after>//
//  RouteSummaryObject.swift
//  TCAT
//
//  Created by <NAME> on 9/10/17.
//  Copyright © 2017 cuappdev. All rights reserved.
//

import UIKit
import CoreLocation

enum PinType: String {
    case stop, place
}

enum NextDirection: String {
    case bus, walk
}

class RouteSummaryObject: NSObject {

    var name: String
    var type: PinType
    var busNumber: Int?
    var nextDirection: NextDirection?
    
    override var description: String {
        return """
        {
            name: \(name),
            type: \(type.rawValue),
            busNumber: \(busNumber ?? -1),
            nextDirection: \(nextDirection?.rawValue ?? "nil")
        }
        """
    }
    
    init(direction: Direction) {
        name = direction.name
        type = direction.type == .walk ? PinType.place : PinType.stop
        busNumber = direction.routeNumber
        nextDirection = direction.type == .depart ? NextDirection.bus: NextDirection.walk
    }
    
    init(name: String, type: PinType) {
        self.name = name
        self.type = type
    }
    
    convenience init(name: String, type: PinType, nextDirection: NextDirection) {
        self.init(name: name, type: type)
        self.nextDirection = nextDirection
    }
    
    convenience init(name: String, type: PinType, nextDirection: NextDirection, busNumber: Int) {
        self.init(name: name, type: type, nextDirection: nextDirection)
        self.busNumber = busNumber
    }
    
    func updateName(from place: Place) {
        name = place.name
    }
    
    func removeNextDirection() {
        nextDirection = nil
    }
}
{'fraction_non_alphanumeric': 0.10469557402830824, 'fraction_numerical': 0.006964727027634239, 'mean_word_length': 2.2687224669603525, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6796538', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1270, 'n_words': 337}