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


Java Priority类代码示例

本文整理汇总了Java中com.android.volley.Request.Priority的典型用法代码示例。如果您正苦于以下问题:Java Priority类的具体用法?Java Priority怎么用?Java Priority使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Priority类属于com.android.volley.Request包,在下文中一共展示了Priority类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compareTo

import com.android.volley.Request.Priority; //导入依赖的package包/类
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:RequestTest.java

示例2: performRequest

import com.android.volley.Request.Priority; //导入依赖的package包/类
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:21,代码来源:RequestQueueTest.java

示例3: testCompareTo

import com.android.volley.Request.Priority; //导入依赖的package包/类
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:19,代码来源:RequestTest.java


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