【Java开源代码栏目提醒】:网学会员Java开源代码为您提供ArchiveList.java参考,解决您在ArchiveList.java学习中工作中的难题,参考学习。
package com.stsc.archive.backup;
import java.util.Hashtable;
import java.util.Enumeration;
public class ArchiveList {
/**
* The set of Subscriptions associated with this User.
*/
private Hashtable archives = new Hashtable();
private int total = 0;
private int curPage = 0;
private String goPage = "1";
/**
* Return the total.
*/
public int getTotal() {
return (this.total);
}
/**
* Set the total.
*
* @param total The new total
*/
public void setTotal(int total) {
this.total = total;
}
/**
* Return the curPage.
*/
public int getCurPage() {
return (this.curPage);
}
/**
* Set the curPage.
*
* @param curPage The new curPage
*/
public void setCurPage(int curPage) {
this.curPage = curPage;
}
/**
* Return the goPage.
*/
public String getGoPage() {
return (this.goPage);
}
/**
* Set the goPage.
*
* @param goPage The new goPage
*/
public void setGoPage(String goPage) {
this.goPage = goPage;
}
public void setGoPage(int goPage) {
this.goPage = String.valueOf(goPage);
}
/**
* Find and return all Archive associated with this user. If there
* are none, a zero-length array is returned.
*/
public Archive[] getArchives() {
synchronized (archives) {
Archive results[] = new Archive[archives.size()];
Enumeration archs = archives.elements();
int n = 0;
while (archs.hasMoreElements()) {
results[n++] = (Archive) archs.nextElement();
}
return (results);
}
}
/**
* Find and return the Subscription associated with the specified host.
* If none is found, return <code>null</code>.
*
* @param host Host name to look up
*/
public Archive findArchive(String serialno) {
if (serialno == null)
return (null);
return ((Archive) archives.get(serialno));
}
// ====================================================== Package Methods
/**
* Add the specified Subscription to the set associated with this User.
*
* @param subscription The subscription to add
*/
void addArchive(Archive archive) {
archives.put(String.valueOf(archive.getSerialno()), archive);
}
/**
* Add the specified Subscription to the set associated with this User.
*
* @param subscription The subscription to add
*/
void addLog(Archive archive) {
archives.put(String.valueOf(archive.getHandleid()), archive);
}
/**
* Remove the specified Subscription from the set associated with
* this User.
*
* @param subscription The subscription to remove
*/
void removeArchive(Archive archive) {
archives.remove(String.valueOf(archive.getSerialno()));
}
}