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
| fun getMineCells(): List<Cell> { | |
| val mineCells = mutableListOf<Cell>() | |
| gameBoardCells.forEach { cell -> | |
| if (cell.isMine()) | |
| mineCells.add(cell) | |
| } | |
| return mineCells | |
| } |
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
| fun getMineCells(): List<IntArray> { | |
| val mineCells = mutableListOf<IntArray>() | |
| gameBoardCells.forEach { cell -> | |
| if (cell[0] == 4) | |
| mineCells.add(cell) | |
| } | |
| return mineCells | |
| } |
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
| fun getAveragePrice(vehicle: Vehicle): Int { | |
| return when (vehicle) { | |
| is CAR -> { | |
| 20000 | |
| } | |
| is MOTORBIKE -> { | |
| 10000 | |
| } | |
| is VAN -> { | |
| 25000 |
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
| fun calculateCost(vehicle: Vehicle): Money { | |
| return when (vehicle) { | |
| is CAR -> { | |
| CalculateCarCost(vehicle) | |
| } | |
| is MOTORBIKE -> { | |
| CalculateMotorbikeCost(vehicle) | |
| } | |
| is VAN -> { | |
| CalculateVanCost(vehicle) |
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
| package com.dropbox.affectedmoduledetector | |
| import java.io.File | |
| class AffectedModuleConfiguration { | |
| /** | |
| * Folder to place the log in | |
| */ | |
| var logFolder: String? = null |
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 Vehicle { | |
| fun getAveragePrice(): Int | |
| fun calculateCost(): Money | |
| fun calculateDailyMaintanence(): Money | |
| } | |
| class VehicleFactory() { | |
| fun makeVehicle(type: VehicleType): Vehicle { | |
| when (type) { | |
| is CAR -> { |
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 BuildTimeLoggerPlugin : Plugin<Project> { | |
| override fun apply(project: Project) { | |
| val gradle = project.gradle | |
| val buildTaskService = registerBuildTaskService(gradle) | |
| } | |
| private fun registerBuildTaskService(gradle: Gradle): Provider<BuildTaskService> { | |
| val registry = gradle.serviceRegistry()[BuildEventListenerRegistryInternal::class.java] | |
| val buildTaskService = gradle.sharedServices.registerIfAbsent("build-task-service", BuildTaskService::class.java) { } |
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 BuildTimeLoggerPlugin : Plugin<Project> { | |
| override fun apply(project: Project) { | |
| val gradle = project.gradle | |
| val buildDurationService = registerBuildDurationService(gradle) | |
| } | |
| private fun registerBuildDurationService(gradle: Gradle): Provider<BuildDurationService> { | |
| val registry = gradle.serviceRegistry()[BuildEventListenerRegistryInternal::class.java] | |
| val buildDurationService = gradle.sharedServices.registerIfAbsent("build-duration-service", BuildDurationService::class.java) { } |
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 BuildTimeLoggerPlugin : Plugin<Project> { | |
| override fun apply(project: Project) { | |
| val gradle = project.gradle | |
| val buildDurationService = registerBuildDurationService(gradle) | |
| val buildTaskService = registerBuildTaskService(gradle) | |
| registerBuildReporterService(gradle, buildDurationService, buildTaskService) | |
| } | |
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
| abstract class BuildReporterService : BuildService<BuildReporterService.Params>, BuildOperationListener, AutoCloseable { | |
| interface Params : BuildServiceParameters { | |
| fun getBuildDurationServiceProvider(): Property<Provider<BuildDurationService>> | |
| fun getBuildTaskServiceProvider(): Property<Provider<BuildTaskService>> | |
| } | |
| override fun started(p0: BuildOperationDescriptor, p1: OperationStartEvent) {} | |
| override fun progress(p0: OperationIdentifier, p1: OperationProgressEvent) {} |
OlderNewer