cellkey.java

来自「数据仓库展示程序」· Java 代码 · 共 61 行

JAVA
61
字号
/*
// $Id: //open/mondrian/src/main/mondrian/rolap/CellKey.java#4 $
// 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 2001-2005 Kana Software, Inc. and others.
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
// jhyde, 10 August, 2001
*/

package mondrian.rolap;

/**
 * todo:
 *
 * @author jhyde
 * @since 10 August, 2001
 * @version $Id: //open/mondrian/src/main/mondrian/rolap/CellKey.java#4 $
 **/
public class CellKey {
    public final int[] ordinals;

    public CellKey(int[] ordinals) {
        this.ordinals = ordinals;
    }

    public boolean equals(Object o) {
        if (o instanceof CellKey) {
            CellKey other = (CellKey) o;
            if (other.ordinals.length != this.ordinals.length) {
                return false;
            }
            for (int i = 0; i < ordinals.length; i++) {
                if (other.ordinals[i] != this.ordinals[i]) {
                    return false;
                }
            }
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        int h = 0;
        for (int i = 0; i < ordinals.length; i++) {
            h = (h * 37) ^ ordinals[i];
        }
        return h;
    }
    CellKey copy() {
        return new CellKey((int[]) ordinals.clone());
    }
};



// End CellKey.java

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?