📄 cache.java
字号:
/**
Cache - Load data from source tables (or select statements) and puts them into
Hatshtable (cache).
Copyright (C) 2002-2003 Together
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Cache.java
Date: 23.01.2003.
@version 1.0.0
@author: Milosevic Sinisa sinisa@prozone.co.yu
*/
package org.webdocwf.util.loader;
import java.util.Hashtable;
import java.util.Vector;
import java.math.BigDecimal;
/**
Cache - Load data from source tables (or select statements) and puts them into
Hatshtable (cache).
*/
public class Cache {
private Hashtable hCache=null;
/**
* Public constructor of cache class.
* Constructor create new hashtable
*/
public Cache() {
this.hCache=new Hashtable();
}
/**
* Public constructor of cache class.
* Constructor set cache table.
* @param cache is cache table.
*/
public Cache(Hashtable cache) {
this.hCache=cache;
}
/**
* Read current cache table
* @return value of parmeter hCache
*/
public Hashtable getCache() {
return this.hCache;
}
/**
* Set cache table.
* @param cache is cache table
*/
public void setCache(Hashtable cache) {
this.hCache=cache;
}
/**
* Put row of source values into cache.
* @param row SQL query row
* @param sourceValues represents source values
*/
public void setCacheRow(BigDecimal row, Vector sourceValues) {
this.hCache.put(row,sourceValues);
}
/**
* Put row of source values into cache.
* @param cache is cache table
* @param row is SQL query row
* @param sourceValues represents source values
*/
public void setCacheRow(Hashtable cache, BigDecimal row, Vector sourceValues) {
cache.put(row,sourceValues);
}
/**
* Read row of source values.
* @param row is SQL query row.
* @return Vector values of source columns.
*/
public Vector getCacheRow(BigDecimal row) {
if(this.hCache.isEmpty())
return null;
else
return (Vector)this.hCache.get(row);
}
/**
* Read row of source values.
* @param row is SQL query row.
* @param cache is cache table
* @return Vector values of source columns.
*/
public Vector getCacheRow(Hashtable cache, BigDecimal row) {
if(cache.isEmpty())
return null;
else
return (Vector)cache.get(row);
}
/**
* Reset cache.
*/
public void resetCache() {
this.hCache.clear();
this.hCache=new Hashtable();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -