sparsesegmentdataset.java
来自「数据仓库展示程序」· Java 代码 · 共 55 行
JAVA
55 行
/*
// $Id: //open/mondrian/src/main/mondrian/rolap/agg/SparseSegmentDataset.java#5 $
// (C) Copyright 2002-2005 Kana Software, Inc.
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// (C) Copyright 2002-2005 Kana Software, Inc. and others.
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
// jhyde, 21 March, 2002
*/
package mondrian.rolap.agg;
import mondrian.olap.Util;
import mondrian.rolap.CellKey;
import java.util.Map;
import java.util.HashMap;
/**
* A <code>SparseSegmentDataset</code> is a means of storing segment values
* which is suitable when few of the combinations of keys have a value present.
*
* <p>The storage requirements are as follows. Key is 1 word for each
* dimension. Hashtable entry is 3 words. Value is 1 word. Total space is (4 +
* d) * v. (May also need hash table to ensure that values are only stored
* once.)</p>
*
* <p>NOTE: This class is not synchronized.</p>
*
* @author jhyde
* @since 21 March, 2002
* @version $Id: //open/mondrian/src/main/mondrian/rolap/agg/SparseSegmentDataset.java#5 $
**/
class SparseSegmentDataset implements SegmentDataset {
private final Map values = new HashMap();
SparseSegmentDataset(Segment segment) {
Util.discard(segment);
}
public Object get(CellKey pos) {
return values.get(pos);
}
void put(CellKey key, Object value) {
values.put(key, value);
}
public double getBytes() {
// assume a slot, key, and value are each 4 bytes
return values.size() * 12;
}
}
// End SparseSegmentDataset.java
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?