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
fun getMineCells(): List<IntArray> { | |
val mineCells = mutableListOf<IntArray>() | |
gameBoardCells.forEach { cell -> | |
if (cell[0] == 4) | |
mineCells.add(cell) | |
} | |
return mineCells | |
} |
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
fun getMineCells(): List<Cell> { | |
val mineCells = mutableListOf<Cell>() | |
gameBoardCells.forEach { cell -> | |
if (cell.isMine()) | |
mineCells.add(cell) | |
} | |
return mineCells | |
} |
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
fun calculateCost(vehicle: Vehicle): Money { | |
return when (vehicle) { | |
is CAR -> { | |
CalculateCarCost(vehicle) | |
} | |
is MOTORBIKE -> { | |
CalculateMotorbikeCost(vehicle) | |
} | |
is VAN -> { | |
CalculateVanCost(vehicle) |
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
fun getAveragePrice(vehicle: Vehicle): Int { | |
return when (vehicle) { | |
is CAR -> { | |
20000 | |
} | |
is MOTORBIKE -> { | |
10000 | |
} | |
is VAN -> { | |
25000 |
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
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 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 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 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 BuildDurationService : BuildService<BuildServiceParameters.None>, BuildOperationListener, AutoCloseable { | |
var buildDuration: Long? = null | |
override fun started(p0: BuildOperationDescriptor, p1: OperationStartEvent) {} | |
override fun progress(p0: OperationIdentifier, p1: OperationProgressEvent) {} | |
override fun finished(buildOperationDescriptor: BuildOperationDescriptor, operationFinishEvent: OperationFinishEvent) { | |
if (buildOperationDescriptor.details is RunRootBuildWorkBuildOperationType.Details) { |
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
abstract class BuildDurationService : BuildService<BuildServiceParameters.None>, BuildOperationListener, AutoCloseable { | |
var buildDuration: Long? = null | |
var configurationDuration: Long? = null | |
var configurationPhaseFailed = true | |
override fun started(p0: BuildOperationDescriptor, p1: OperationStartEvent) {} | |
override fun progress(p0: OperationIdentifier, p1: OperationProgressEvent) {} |
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
abstract class BuildTaskService : BuildService<BuildServiceParameters.None>, OperationCompletionListener { | |
var fromCacheTasksCount = 0 | |
var upToDateTasksCount = 0 | |
var executedTasksCount = 0 | |
var buildPhaseFailureMessage: String? = null | |
val buildPhaseFailed: Boolean | |
get() = buildPhaseFailureMessage != null |
OlderNewer