This file contains hidden or 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
private class PatternDetectorConnector( | |
private val first: PatternDetector, | |
private val second: PatternDetector): PatternDetector { | |
override fun findPatterns(data: List<Weight>): List<Pattern> { | |
val firstPatterns = first.findPatterns(data) | |
val secondPatterns = seconnd.findPatterns(data) | |
return firstPatterns + secondPatterns | |
} |
This file contains hidden or 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
``` | |
interface PatternDetector { | |
fun findPatterns(data: List<Weight>): List<Pattern> | |
} | |
``` |
This file contains hidden or 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
interface Stage : ReadMeasureSettings, ReadTimestamp { | |
interface Pending : Stage, ReadRawImage | |
interface ShapeDetection : Stage, ReadPreparedImage | |
interface FeatureDetection : Stage, ReadPreparedImage, ReadShapes | |
interface PersonDetection : Stage, ReadPreparedImage, ReadFeatures | |
interface Measurement : Stage, ReadPeople | |
} |
This file contains hidden or 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
val Request<out ReadRawImage>.image get() = Request.imageOf(this) | |
val Request<out ReadTimestamp>.timestamp get() = Request.timestampOf(this) | |
val Request<out ReadMeasureSettings>.measureSettings get() = Request.measureSettingsOf(this) | |
val Request<out ReadPreparedImage>.image get() = Request.preparedImageOf(this) | |
val Request<out ReadPreparedImage>.scaledImage get() = Request.scaledPreparedImageOf(this) | |
val Request<out ReadShapes>.shapes get() = Request.shapesOf(this) | |
val Request<out ReadFeatures>.features get() = Request.featuresOf(this) | |
val Request<out ReadPeople>.people get() = Request.peopleOf(this) |
This file contains hidden or 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 Request<T>( | |
private val image: Image?, | |
private val timestamp: Timestamp?, | |
private val measureSettings: MeasureSettings?, | |
private val preparedImage: Mat?, | |
private val scaledPreparedImage: Mat?, | |
private val shapes: List<Shape>?, | |
private val features: List<Feature>?, | |
private val people: List<Person>?) { |
This file contains hidden or 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
interface ReadRawImage | |
interface ReadTimestamp | |
interface ReadMeasureSettings | |
interface ReadPreparedImage | |
interface ReadShapes | |
interface ReadFeatures | |
interface ReadPeople |
This file contains hidden or 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
/* | |
* This is our Request type. It is basically a holder for all | |
* information we could wish from it. But we cannot read anything from it directly. | |
* It has a type param T. | |
* T is not used anywhere in Request directly, hence why it is called Phantom Type. | |
*/ | |
class Request<T> ( | |
private val image: Image?, | |
private val timestamp: Timestamp?, | |
private val measureSettings: MeasureSettings?, |
This file contains hidden or 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
/** | |
* This is our base request. | |
* It contains the image taken by the camera | |
* The timestamp when it was taken (because it obviously matters) | |
* And some additional settings for the measure algorithm | |
*/ | |
open class Request( | |
val image: Image, | |
val timestamp: Timestamp, | |
val settings: MeasureSettings) |
NewerOlder