This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// GpxParser.swift | |
// mockLocation | |
// | |
// Created by Manish Katoch on 11/29/17. | |
// Copyright © 2017 Manish Katoch. All rights reserved. | |
// | |
protocol GpxParsing: NSObjectProtocol { | |
func parser(_ parser: GpxParser, didCompleteParsing locations: Queue<CLLocation>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Queue.swift | |
// mockLocation | |
// | |
// Created by Manish Katoch on 11/29/17. | |
// Copyright © 2017 Manish Katoch. All rights reserved. | |
// | |
import Foundation | |
import CoreLocation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MockCLLocationManager.swift | |
// | |
// Created by Manish Katoch on 11/28/17. | |
// Copyright © 2017 Manish Katoch. All rights reserved. | |
// | |
import Foundation | |
import CoreLocation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CLLocationManager+Swizzle.swift | |
// mockLocation | |
// | |
// Created by Manich Katoch on 11/30/17. | |
// Copyright © 2017 mk. All rights reserved. | |
// | |
import Foundation | |
import MapKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// mockLocation | |
// | |
// Created by Manich Katoch on 11/28/17. | |
// Copyright © 2017 mk. All rights reserved. | |
// | |
import UIKit | |
import MapKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implicitNotFound(msg = "${PName} not found in ${T}") | |
trait PropertyExists[T, PName, PType] | |
object PropertyExists { | |
def apply[T, PType](column: Witness)( | |
implicit exists: PropertyExists[T, column.T, PType]): PropertyExists[T, column.T, PType] = | |
exists | |
implicit def implicitProvider[T, H <: HList, PName, PType]( | |
implicit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object syntax { | |
implicit class RichDataSet[A](dataSet: Dataset[A]) { | |
val enriched = this | |
def apply[K](column: Witness.Lt[Symbol])(implicit | |
exists: PropertyExists[A, column.T, K]): Column = | |
new Column(column.value.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JoinDataSet[L, R](lhs: Dataset[L], rhs: Dataset[R], joinType: String) | |
object JoinDataSet { | |
def apply[L, R](lhs: Dataset[L], rhs: Dataset[R], joinType: String) = new JoinDataSet(lhs, rhs, joinType) | |
def leftJoin[L, R](lhs: Dataset[L], rhs: Dataset[R]) = JoinDataSet(lhs, rhs, "leftOuter") | |
def rightJoin[L, R](lhs: Dataset[L], rhs: Dataset[R]) = JoinDataSet(lhs, rhs, "rightOuter") | |
def fullOuterJoin[L, R](lhs: Dataset[L], rhs: Dataset[R]) = JoinDataSet(lhs, rhs, "fullOuter") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JoinDataSet[L, R](lhs: Dataset[L], rhs: Dataset[R], joinType: String) { | |
def withKey[K](column: Witness.Lt[Symbol])(implicit | |
lhsExists: PropertyExists[L, column.T, K], | |
rhsExists: PropertyExists[R, column.T, K]): DataFrame = | |
doJoin(Seq(column.value.name)) | |
private def doJoin(columns: Seq[String]) = lhs.join(rhs, columns, joinType) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JoinDataSet[L, R](lhs: Dataset[L], rhs: Dataset[R], joinType: String) { | |
object on extends SingletonProductArgs { | |
def applyProduct[V <: HList, K](columns: V)(implicit | |
i0: ToTraversable.Aux[V, List, Symbol], | |
lhsExists: PropertiesExists[L, V, K], | |
rhsExists: PropertiesExists[R, V, K]): DataFrame = | |
doJoin(columns.toList[Symbol].map(_.name)) | |
} |
OlderNewer