当前位置: 首页>>代码示例>>Java>>正文


Java ObservableDouble.set方法代码示例

本文整理汇总了Java中android.databinding.ObservableDouble.set方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableDouble.set方法的具体用法?Java ObservableDouble.set怎么用?Java ObservableDouble.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.databinding.ObservableDouble的用法示例。


在下文中一共展示了ObservableDouble.set方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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


注:本文中的android.databinding.ObservableDouble.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。