Skip to content

Commit 7d268b2

Browse files
move rx.lang.scala.subscriptions.Subscription to rx.lang.scala.Subscription (mirror Java package structure)
1 parent 01b677e commit 7d268b2

File tree

4 files changed

+33
-39
lines changed

4 files changed

+33
-39
lines changed

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/ImplicitFunctionConversions.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ import java.{ lang => jlang }
2020
import rx.lang.scala._
2121
import rx.util.functions._
2222
import scala.collection.Seq
23-
import rx.lang.scala.subscriptions.Subscription
2423
import java.{lang => jlang}
2524
import scala.language.implicitConversions
26-
import rx.lang.scala.Observer
27-
import rx.lang.scala.Scheduler
2825

2926
/**
3027
* These function conversions convert between Scala functions and Rx `Func`s and `Action`s.

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Scheduler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import scala.concurrent.duration.Duration
55
import ImplicitFunctionConversions.scalaFunction0ProducingUnitToAction0
66
import ImplicitFunctionConversions.schedulerActionToFunc2
77
import rx.util.functions.{Action0, Action1, Func2}
8-
import rx.lang.scala.subscriptions.Subscription
8+
import rx.lang.scala.Subscription
99

1010
/**
1111
* Represents an object thatimport rx.lang.scala.ImplicitFunctionConversions
Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,64 @@
11
/**
22
* Copyright 2013 Netflix, Inc.
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
1616

17-
package rx.lang.scala {
17+
package rx.lang.scala
1818

19-
/**
19+
/**
2020
* Subscriptions are returned from all `Observable.subscribe` methods to allow unsubscribing.
2121
*
2222
* This interface is the equivalent of `IDisposable` in the .NET Rx implementation.
2323
*/
24-
trait Subscription {
24+
trait Subscription {
2525

26-
val asJavaSubscription: rx.Subscription
26+
val asJavaSubscription: rx.Subscription
2727

28-
/**
29-
* Call this method to stop receiving notifications on the Observer that was registered when
30-
* this Subscription was received.
31-
*/
32-
def unsubscribe(): Unit = asJavaSubscription.unsubscribe()
28+
/**
29+
* Call this method to stop receiving notifications on the Observer that was registered when
30+
* this Subscription was received.
31+
*/
32+
def unsubscribe(): Unit = asJavaSubscription.unsubscribe()
3333

34-
/**
35-
* Checks if the subscription is unsubscribed.
36-
*/
37-
def isUnsubscribed: Boolean
38-
}
34+
/**
35+
* Checks if the subscription is unsubscribed.
36+
*/
37+
def isUnsubscribed: Boolean
3938
}
4039

41-
package rx.lang.scala.subscriptions {
42-
43-
import rx.lang.scala.Subscription
44-
import java.util.concurrent.atomic.AtomicBoolean
45-
46-
4740
object Subscription {
48-
41+
import java.util.concurrent.atomic.AtomicBoolean
42+
import rx.lang.scala.subscriptions._
43+
4944
/**
50-
* Creates an [[rx.lang.scala.Subscription]] from an[[rx.Subscription]].
45+
* Creates an [[rx.lang.scala.Subscription]] from an [[rx.Subscription]].
5146
*/
5247
def apply(subscription: rx.Subscription): Subscription = {
53-
subscription match {
54-
case x: rx.subscriptions.BooleanSubscription => new BooleanSubscription(x)
55-
case x: rx.subscriptions.CompositeSubscription => new CompositeSubscription(x)
56-
case x: rx.subscriptions.MultipleAssignmentSubscription => new MultipleAssignmentSubscription(x)
57-
case x: rx.subscriptions.SerialSubscription => new SerialSubscription(x)
58-
case x: rx.Subscription => Subscription { x.unsubscribe() }
59-
}
48+
subscription match {
49+
case x: rx.subscriptions.BooleanSubscription => new BooleanSubscription(x)
50+
case x: rx.subscriptions.CompositeSubscription => new CompositeSubscription(x)
51+
case x: rx.subscriptions.MultipleAssignmentSubscription => new MultipleAssignmentSubscription(x)
52+
case x: rx.subscriptions.SerialSubscription => new SerialSubscription(x)
53+
case x: rx.Subscription => Subscription { x.unsubscribe() }
54+
}
6055
}
6156

6257
/**
6358
* Creates an [[rx.lang.scala.Subscription]] that invokes the specified action when unsubscribed.
6459
*/
65-
def apply(u: => Unit): Subscription = {
66-
new Subscription () {
60+
def apply(u: => Unit): Subscription = {
61+
new Subscription() {
6762

6863
private val unsubscribed = new AtomicBoolean(false)
6964
def isUnsubscribed = unsubscribed.get()
@@ -73,7 +68,7 @@ object Subscription {
7368
}
7469
}
7570
}
76-
}
71+
7772
}
7873

7974

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/subscriptions/SubscriptionTests.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import org.junit.Assert._
44
import org.junit.Test
55
import org.scalatest.junit.JUnitSuite
66

7+
import rx.lang.scala.Subscription
8+
79
class SubscriptionTests extends JUnitSuite {
810

911
@Test

0 commit comments

Comments
 (0)