<commit_before>//
//  Pokemon.swift
//  PokeMap
//
//  Created by <NAME> on 20/07/16.
//  Copyright © 2016 Faber Ventures. All rights reserved.
//

import Foundation
import ObjectMapper

struct Pokemon: Mappable, Equatable {
  
  var pokemonId: String!
  var expirationTime: NSDate!
  var latitude: Double!
  var longitude: Double!
  var isAlive: Bool!
  var uid: String!
  var id: String!
  
  var imageURL: NSURL {
    return NSURL(string: "https://ugc.pokevision.com/images/pokemon/\(pokemonId).png")!
  }
  
  var name: String {
    return PokedexHelper.sharedInstance.nameFromId(pokemonId)
  }
  
  var expired: Bool {
    return expirationTime.compare(NSDate()) != .OrderedDescending
  }
  
  // MARK: JSON
  init?(_ map: Map) {
    let keys = ["id", "uid", "expiration_time", "pokemonId", "latitude", "longitude", "is_alive"]
    guard JSONHelper.containsKeys(map.JSONDictionary, keys: keys) else {
      print(map.JSONDictionary)
      return nil
    }
  }
  
  mutating func mapping(map: Map) {
    id <- map["id"]
    uid <- map["uid"]
    pokemonId <- map["pokemonId"]
    expirationTime <- (map["expiration_time"], EpochDateTransform())
    latitude <- map["latitude"]
    longitude <- map["longitude"]
    isAlive <- map["is_alive"]
  }
  
}

func == (lhs: Pokemon, rhs: Pokemon) -> Bool {
  return lhs.uid == rhs.uid
}<commit_msg>compare Pokemons by id and not uid<commit_after>//
//  Pokemon.swift
//  PokeMap
//
//  Created by <NAME> on 20/07/16.
//  Copyright © 2016 Faber Ventures. All rights reserved.
//

import Foundation
import ObjectMapper

struct Pokemon: Mappable, Equatable {
  
  var pokemonId: String!
  var expirationTime: NSDate!
  var latitude: Double!
  var longitude: Double!
  var isAlive: Bool!
  var uid: String!
  var id: String!
  
  var imageURL: NSURL {
    return NSURL(string: "https://ugc.pokevision.com/images/pokemon/\(pokemonId).png")!
  }
  
  var name: String {
    return PokedexHelper.sharedInstance.nameFromId(pokemonId)
  }
  
  var expired: Bool {
    return expirationTime.compare(NSDate()) != .OrderedDescending
  }
  
  // MARK: JSON
  init?(_ map: Map) {
    let keys = ["id", "uid", "expiration_time", "pokemonId", "latitude", "longitude", "is_alive"]
    guard JSONHelper.containsKeys(map.JSONDictionary, keys: keys) else {
      print(map.JSONDictionary)
      return nil
    }
  }
  
  mutating func mapping(map: Map) {
    id <- map["id"]
    uid <- map["uid"]
    pokemonId <- map["pokemonId"]
    expirationTime <- (map["expiration_time"], EpochDateTransform())
    latitude <- map["latitude"]
    longitude <- map["longitude"]
    isAlive <- map["is_alive"]
  }
}

func == (lhs: Pokemon, rhs: Pokemon) -> Bool {
  return lhs.id == rhs.id
}
{'fraction_non_alphanumeric': 0.14275147928994084, 'fraction_numerical': 0.0073964497041420114, 'mean_word_length': 3.1487730061349692, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '2982689', 'n_tokens_mistral': 1001, 'n_tokens_neox': 951, 'n_words': 230}