package com.supcon.hospital.jianche.service;
import java.util.Hashtable;
/**
* @date 2012-10-11 */public class VideoHashTable { private static VideoHashTable receHashTable; private Hashtable<Long, Long> rht = new Hashtable<Long, Long>(); private boolean updateFlag = true; private VideoHashTable(){ } public static VideoHashTable getInstance(){ if(receHashTable == null){ receHashTable = new VideoHashTable(); } return receHashTable; } /** * *@方法名称:addHashtable *@输 入: *@输 出: *@作 者: *@创建日期:2012-9-13 *@方法描述: 往hashtable中增加读类型的消息 * @param key * @param value void */ public void addHashtable(Long key, Long value){ rht.put(key, value); }/** * *@方法名称:getHashtable *@输 入: *@输 出: *@作 者: *@创建日期:2012-9-13 *@方法描述: 根据key查找对应的消息 * @param key * @return Object */ public Long getHashtable(Long key){ return rht.get(key); }
public Hashtable<Long, Long> getRht() {
return rht; }public void setRht(Hashtable<Long, Long> rht) {
this.rht = rht; } public void remove(){ rht.clear(); }public boolean isUpdateFlag() {
return updateFlag; }public void setUpdateFlag(boolean updateFlag) {
this.updateFlag = updateFlag; }}
调用:VideoHashTable videoHashTable = VideoHashTable.getInstance();
Hashtable<Long, Long> hashTable = videoHashTable.getRht();