From 64a6cd08f7a7c393beba55eb6f9ed03590a992be Mon Sep 17 00:00:00 2001 From: Loredana Date: Sun, 28 Jun 2020 21:23:57 +0300 Subject: [PATCH] KTLN-137 move kotlin article --- .../java/com/baeldung/observer/IObservable.kt | 18 ------------------ .../java/com/baeldung/observer/IObserver.kt | 5 ----- .../observer/delegates/BaeldungNewsletter.kt | 10 ---------- .../observer/delegates/BaeldungReader.kt | 8 -------- .../observer/standard/BaeldungNewsletter.kt | 14 -------------- .../observer/standard/BaeldungReader.kt | 9 --------- 6 files changed, 64 deletions(-) delete mode 100644 patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/IObservable.kt delete mode 100644 patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/IObserver.kt delete mode 100644 patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/delegates/BaeldungNewsletter.kt delete mode 100644 patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/delegates/BaeldungReader.kt delete mode 100644 patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/standard/BaeldungNewsletter.kt delete mode 100644 patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/standard/BaeldungReader.kt diff --git a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/IObservable.kt b/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/IObservable.kt deleted file mode 100644 index e896d55cf2..0000000000 --- a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/IObservable.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.observer - -import java.util.ArrayList - -interface IObservable { - val observers: ArrayList - fun add(observer: IObserver) { - observers.add(observer) - } - - fun remove(observer: IObserver) { - observers.remove(observer) - } - - fun sendUpdateEvent() { - observers.forEach { it.update() } - } -} \ No newline at end of file diff --git a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/IObserver.kt b/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/IObserver.kt deleted file mode 100644 index e2187a9fcb..0000000000 --- a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/IObserver.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.baeldung.observer - -interface IObserver { - fun update() -} \ No newline at end of file diff --git a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/delegates/BaeldungNewsletter.kt b/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/delegates/BaeldungNewsletter.kt deleted file mode 100644 index 748c1064ff..0000000000 --- a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/delegates/BaeldungNewsletter.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.observer.delegates - -import kotlin.properties.Delegates - -class BaeldungNewsletter { - val newestArticleObservers = mutableListOf<(String) -> Unit>() - var newestArticleUrl: String by Delegates.observable("") { _, _, newValue -> - newestArticleObservers.forEach { it(newValue) } - } -} \ No newline at end of file diff --git a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/delegates/BaeldungReader.kt b/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/delegates/BaeldungReader.kt deleted file mode 100644 index f275648549..0000000000 --- a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/delegates/BaeldungReader.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.observer.delegates - -fun main() { - val newsletter = BaeldungNewsletter() - newsletter.newestArticleObservers.add { newestArticleUrl -> - println("New Baeldung article: ${newestArticleUrl}") - } -} \ No newline at end of file diff --git a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/standard/BaeldungNewsletter.kt b/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/standard/BaeldungNewsletter.kt deleted file mode 100644 index 0ec4796edb..0000000000 --- a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/standard/BaeldungNewsletter.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.observer.standard - -import com.baeldung.observer.IObservable -import com.baeldung.observer.IObserver -import java.util.ArrayList - -class BaeldungNewsletter : IObservable { - override val observers: ArrayList = ArrayList() - var newestArticleUrl = "" - set(value) { - field = value - sendUpdateEvent() - } -} \ No newline at end of file diff --git a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/standard/BaeldungReader.kt b/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/standard/BaeldungReader.kt deleted file mode 100644 index 14e686f2f8..0000000000 --- a/patterns/design-patterns-behavioral-2/src/main/java/com/baeldung/observer/standard/BaeldungReader.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.observer.standard - -import com.baeldung.observer.IObserver - -class BaeldungReader(private var newsletter: BaeldungNewsletter) : IObserver { - override fun update() { - println("New Baeldung article: ${newsletter.newestArticleUrl}") - } -} \ No newline at end of file