mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 12:22:12 +00:00
Merge pull request #130 from Fs00/master
Make Kotlin version fully equivalent to C# and Java ones
This commit is contained in:
commit
16dd174765
@ -1,5 +1,5 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.2.21'
|
ext.kotlin_version = '1.3.41'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -11,7 +11,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.jvm" version "1.2.21"
|
id "org.jetbrains.kotlin.jvm" version "1.3.41"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|||||||
BIN
Kotlin/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
Kotlin/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,5 +1,6 @@
|
|||||||
|
#Wed Nov 20 10:18:48 CET 2019
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@ -4,9 +4,9 @@ class GildedRose(var items: Array<Item>) {
|
|||||||
|
|
||||||
fun updateQuality() {
|
fun updateQuality() {
|
||||||
for (i in items.indices) {
|
for (i in items.indices) {
|
||||||
if (!items[i].name.equals("Aged Brie") && !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
if (items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert") {
|
||||||
if (items[i].quality > 0) {
|
if (items[i].quality > 0) {
|
||||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
|
||||||
items[i].quality = items[i].quality - 1
|
items[i].quality = items[i].quality - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,7 +14,7 @@ class GildedRose(var items: Array<Item>) {
|
|||||||
if (items[i].quality < 50) {
|
if (items[i].quality < 50) {
|
||||||
items[i].quality = items[i].quality + 1
|
items[i].quality = items[i].quality + 1
|
||||||
|
|
||||||
if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
if (items[i].name == "Backstage passes to a TAFKAL80ETC concert") {
|
||||||
if (items[i].sellIn < 11) {
|
if (items[i].sellIn < 11) {
|
||||||
if (items[i].quality < 50) {
|
if (items[i].quality < 50) {
|
||||||
items[i].quality = items[i].quality + 1
|
items[i].quality = items[i].quality + 1
|
||||||
@ -30,15 +30,15 @@ class GildedRose(var items: Array<Item>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
|
||||||
items[i].sellIn = items[i].sellIn - 1
|
items[i].sellIn = items[i].sellIn - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items[i].sellIn < 0) {
|
if (items[i].sellIn < 0) {
|
||||||
if (!items[i].name.equals("Aged Brie")) {
|
if (items[i].name != "Aged Brie") {
|
||||||
if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
if (items[i].name != "Backstage passes to a TAFKAL80ETC concert") {
|
||||||
if (items[i].quality > 0) {
|
if (items[i].quality > 0) {
|
||||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
|
||||||
items[i].quality = items[i].quality - 1
|
items[i].quality = items[i].quality - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
package com.gildedrose
|
package com.gildedrose
|
||||||
|
|
||||||
data class Item(var name: String, var sellIn: Int, var quality: Int)
|
open class Item(var name: String, var sellIn: Int, var quality: Int) {
|
||||||
|
override fun toString(): String {
|
||||||
|
return this.name + ", " + this.sellIn + ", " + this.quality
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user