當前位置: 首頁>>代碼示例>>Java>>正文


Java ObservableDouble類代碼示例

本文整理匯總了Java中android.databinding.ObservableDouble的典型用法代碼示例。如果您正苦於以下問題:Java ObservableDouble類的具體用法?Java ObservableDouble怎麽用?Java ObservableDouble使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ObservableDouble類屬於android.databinding包,在下文中一共展示了ObservableDouble類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: takeTakesCorrectTimes

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void takeTakesCorrectTimes() throws Exception {
    double double1 = 123;
    double double2 = 32;
    ObservableDouble observed = new ObservableDouble(double1);
    ObservableDouble observing = Cinder.computeDouble(()->
                    observed.get()
            , observed).take(2).immediate();
    assertTrue(observing.get() == double1);

    observed.set(double2);
    assertTrue(observing.get() == double2);

    observed.set(double1);
    assertTrue(observing.get() == double2);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:17,代碼來源:CinderDoubleUnitTest.java

示例2: skipSkipsCorrectTimes

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void skipSkipsCorrectTimes() throws Exception {
    double double1 = 123;
    double double2 = 32;
    ObservableDouble observed = new ObservableDouble();
    ObservableDouble observing = Cinder.computeDouble(()->
                    observed.get()
            , observed).skip(1);

    observed.set(double1);
    assertTrue(observing.get() == 0);

    observed.set(double2);
    assertTrue(observing.get() == double2);

    observed.set(double1);
    assertTrue(observing.get() == double1);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:19,代碼來源:CinderDoubleUnitTest.java

示例3: Listener

import android.databinding.ObservableDouble; //導入依賴的package包/類
Listener(final ObservableDouble observableDouble, final Observer<? super Double> observer) {
  this.observableDouble = observableDouble;
  this.onPropertyChangedCallback =
      new android.databinding.Observable.OnPropertyChangedCallback() {
        @Override
        public void onPropertyChanged(android.databinding.Observable observable,
            int ignoredPropertyId) {
          if (!isDisposed()) {
            ObservableDouble observableDouble = (ObservableDouble) observable;
            observer.onNext(observableDouble.get());
          }
        }
      };
}
 
開發者ID:oldergod,項目名稱:RxDataBinding,代碼行數:15,代碼來源:ObservableDoubleObservable.java

示例4: computesDouble

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void computesDouble() throws Exception {
    double double1 = 0.35;
    double double2 = 234.09;
    ObservableDouble obsDouble = new ObservableDouble(double1);
    ObservableDouble computedDouble = Cinder.computeDouble(()->obsDouble.get(), obsDouble).immediate();
    assertEquals(computedDouble.get(), double1, 0.001);

    obsDouble.set(double2);
    assertEquals(computedDouble.get(), double2, 0.001);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:12,代碼來源:CinderUnitTest.java

示例5: onceTakesOnce

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void onceTakesOnce() throws Exception {
    double double1 = 123;
    double double2 = 43;
    ObservableDouble observed = new ObservableDouble(double1);
    ObservableDouble observing = Cinder.computeDouble(()->
            observed.get(), observed).once().immediate();
    assertTrue(observing.get() == double1);

    observed.set(double2);
    assertTrue(observing.get() == double1);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:13,代碼來源:CinderDoubleUnitTest.java

示例6: filterFilters

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void filterFilters() throws Exception {
    double double1 = 123;
    double double2 = 32;
    ObservableDouble observed = new ObservableDouble();
    ObservableDouble observing = Cinder.computeDouble(()->
                    observed.get()
            , observed).filter(()->observed.get() == double1);

    observed.set(double2);
    assertTrue(observing.get() == 0);

    observed.set(double1);
    assertTrue(observing.get() == double1);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:16,代碼來源:CinderDoubleUnitTest.java

示例7: takeWhileTakesWhileTrue

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void takeWhileTakesWhileTrue() throws Exception {
    double double1 = 123;
    double double2 = 32;
    ObservableDouble observed = new ObservableDouble();
    ObservableDouble observing = Cinder.computeDouble(()->
                    observed.get()
            , observed).takeWhile(()->observed.get() == double1);

    observed.set(double1);
    assertTrue(observing.get() == double1);

    observed.set(double2);
    assertTrue(observing.get() == double1);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:16,代碼來源:CinderDoubleUnitTest.java

示例8: skipWhileSkipsWhileTrue

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void skipWhileSkipsWhileTrue() throws Exception {
    double double1 = 123;
    double double2 = 32;
    ObservableDouble observed = new ObservableDouble();
    ObservableDouble observing = Cinder.computeDouble(()->
                    observed.get()
            , observed).skipWhile(()->observed.get() == double1);

    observed.set(double1);
    assertTrue(observing.get() == 0);

    observed.set(double2);
    assertTrue(observing.get() == double2);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:16,代碼來源:CinderDoubleUnitTest.java

示例9: withDefaultAssignsDefault

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void withDefaultAssignsDefault() throws Exception {
    double double1 = 12;
    ObservableDouble observing = Cinder.computeDouble(()->0
    ).withDefault(double1);

    assertTrue(observing.get() == double1);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:9,代碼來源:CinderDoubleUnitTest.java

示例10: stopStops

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void stopStops() throws Exception {
    double double1 = 123;
    double double2 = 43;
    ObservableDouble observed = new ObservableDouble(double1);
    CinderDouble observing = Cinder.computeDouble(()->
            observed.get(), observed).immediate();
    assertTrue(observing.get() == double1);

    observing.stop();

    observed.set(double2);
    assertTrue(observing.get() == double1);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:15,代碼來源:CinderDoubleUnitTest.java

示例11: convertsObservableDoubleToRx

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void convertsObservableDoubleToRx() throws Exception {
    ObservableDouble observableDouble = new ObservableDouble();
    Observable<Double> rxDouble = RxCinder.convert(observableDouble);

    final String TEST_KEY = "TEST_KEY";
    final ArrayMap<String, Double> testMap = new ArrayMap<>();
    rxDouble.subscribe((c)->{
        testMap.put(TEST_KEY, c);});

    final double TEST_DOUBLE = 23;
    observableDouble.set(TEST_DOUBLE);
    assertTrue(testMap.get(TEST_KEY).equals(TEST_DOUBLE));
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:15,代碼來源:RxCinderUnitTest.java

示例12: convertsRxDoubleToObservable

import android.databinding.ObservableDouble; //導入依賴的package包/類
@Test
public void convertsRxDoubleToObservable() throws Exception {
    double TEST_DOUBLE = 234;
    Observable<Double> rxDouble = Observable.just(TEST_DOUBLE);
    ObservableDouble observableDouble = RxCinder.convertDouble(rxDouble);
    assertTrue(observableDouble.get() == TEST_DOUBLE);
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:8,代碼來源:RxCinderUnitTest.java

示例13: ObservableDoubleObservable

import android.databinding.ObservableDouble; //導入依賴的package包/類
ObservableDoubleObservable(ObservableDouble observableDouble) {
  this.observableDouble = observableDouble;
}
 
開發者ID:oldergod,項目名稱:RxDataBinding,代碼行數:4,代碼來源:ObservableDoubleObservable.java

示例14: convert

import android.databinding.ObservableDouble; //導入依賴的package包/類
public static Observable<Double> convert(ObservableDouble observableDouble){
    return Observable.create((e)->
        Cinder.observe(()->e.onNext(observableDouble.get()), observableDouble)
    );
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:6,代碼來源:RxCinder.java

示例15: convertDouble

import android.databinding.ObservableDouble; //導入依賴的package包/類
public static ObservableDouble convertDouble(Observable<Double> observable){
    ObservableDouble observableDouble = new ObservableDouble();
    observable.subscribe((d)->observableDouble.set(d));
    return observableDouble;
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:6,代碼來源:RxCinder.java


注:本文中的android.databinding.ObservableDouble類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。