Copyright (c) 2011, 2012, Digital Lizard (Oscar Key, Thomas Boby)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the...
If you think the Android project BBC-News-Reader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*******************************************************************************
* BBC News Reader//fromwww.java2s.com
* Released under the BSD License. See README or LICENSE.
* Copyright (c) 2011, Digital Lizard (Oscar Key, Thomas Boby)
* All rights reserved.
******************************************************************************/package com.digitallizard.bbcnewsreader.resource.web;
publicclass QueueItem implements Comparable<QueueItem> {
publicstaticfinalint PRIORITY_DOWNLOAD_NOW = 5; // the priority if instant download is needed
private String url;
privateint type;
privateint itemId;
privateint priority;
public QueueItem(String url, int type, int itemId, int priority) {
this.url = url;
this.type = type;
this.itemId = itemId;
this.priority = priority;
}
publicint compareTo(QueueItem item) {
if (this.priority < item.getPriority()) {
return 1;
}
elseif (this.priority > item.getPriority()) {
return -1;
}
else {
return 0;
}
}
publicint getType() {
return type;
}
public String getUrl() {
return url;
}
publicint getItemId() {
return itemId;
}
publicboolean wasSpecificallyRequested() {
if (priority == PRIORITY_DOWNLOAD_NOW) {
return true;
}
else {
return false;
}
}
publicint getPriority() {
return this.priority;
}
publicvoid setPriority(int priority) {
this.priority = priority;
}
}