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
| { | |
| "name": "Main", | |
| "rules": [ | |
| { | |
| "name": "Hide garbage items", | |
| "enabled": true, | |
| "ruleType": "hide", | |
| "filterEtherealSocketed": false, | |
| "itemCode": [ | |
| "hp2", |
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
| import com.sun.management.OperatingSystemMXBean | |
| import java.lang.System.currentTimeMillis | |
| import java.lang.management.ManagementFactory | |
| import java.util.concurrent.Semaphore | |
| import java.util.concurrent.atomic.AtomicInteger | |
| import java.util.concurrent.locks.ReentrantLock | |
| import kotlin.concurrent.withLock | |
| import kotlin.reflect.KFunction0 | |
| import kotlin.system.measureTimeMillis |
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
| import java.util.List; | |
| public class MergeSort { | |
| /** | |
| * property: merge of two sorted lists is also sorted | |
| * <p> | |
| * Algorithm description: | |
| * <p> | |
| * merge two lists | |
| * |
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
| /** | |
| * property: merge of two sorted lists is also sorted | |
| * | |
| * Algorithm description: | |
| * | |
| * merge two lists [xs] and [ys] into new result list containing all elements from [xs] and [ys] | |
| * added according to the following rules: | |
| * | |
| * assume tail of [xs] is the list containing all elements from [xs] except first one preserving order | |
| * |
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 astrology | |
| import java.util.* | |
| import java.util.Calendar.* | |
| import kotlin.math.max | |
| import kotlin.random.Random | |
| private val months = listOf( | |
| "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" | |
| ) |
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
| /** | |
| * абстрактный класс, реализующий [Any.equals], [Any.hashCode] и [Any.toString] | |
| */ | |
| private abstract class EQHashString<out T> { | |
| protected abstract val source: T | |
| override fun equals(other: Any?) = | |
| this === other || | |
| other is EQHashString<*> && this::class == other::class && source == other.source | |
| override fun hashCode() = source.hashCode() |
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 Medic(val name: String?) | |
| class ClassModel(val medic: Medic?) | |
| class TxtName(var text: String) | |
| fun main(args: Array<String>) { | |
| val classModel = ClassModel(Medic("foo")) | |
| val txtName = TxtName("bar") | |
| classModel |
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
| data class Foo(val field1: String, val field2: String) | |
| fun main(args: Array<String>) { | |
| val foo = Foo("foo", "bar") | |
| println(foo.field1) // прямой доступ к полю field1 | |
| println(foo.field2) // прямой доступ к полю field2 | |
| val field1Getter: (Foo) -> String = Foo::field1 // геттер поля field1 (его можно передавать в методы, возвращать из методов и т.п.) | |
| val field2Getter: (Foo) -> String = Foo::field2 // геттер поля field2 (его можно передавать в методы, возвращать из методов и т.п.) |
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 calculateResponse: (UserData) -> CreditValue = { userData -> | |
| val credit = userData.state.credit | |
| val balance = userData.state.balance | |
| val payForDay = userData.tariff.price / 30 | |
| // todo: Проверить правильный подсчет дней | |
| val daysLeftWithoutCredit = balance / payForDay | |
| val canSetCredit = daysLeftWithoutCredit <= 1 | |
| when { |
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 credentials = localService.getCredentials() | |
| val sendResult = credentials | |
| ?.let(remoteService::getUserData) | |
| ?.let(UserDataResponseMapper()::map) | |
| ?.let { userData -> | |
| val credit = userData.state.credit | |
| val balance = userData.state.balance | |
| val payForDay = userData.tariff.price / 30 |
NewerOlder