columnconstraint.java

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

JAVA
69
字号
/*
//$Id: //open/mondrian/src/main/mondrian/rolap/agg/ColumnConstraint.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.
//Copyright (C) 2004-2005 TONBELLER AG
//All Rights Reserved.
//You must accept the terms of that agreement to use this software.
*/
package mondrian.rolap.agg;

import mondrian.rolap.RolapMember;

/**
 * A <code>ColumnConstraint</code> is an Object to constraining a
 * column (WHERE-Clause) when a segment is loaded.
 */
public class ColumnConstraint {

    private final Object value;
    private final RolapMember member;

    public ColumnConstraint(Object o) {
        if ( o instanceof RolapMember ) {
            member = (RolapMember) o;
            value = member.getSqlKey();
        } else {
            member = null;
            value = o;
        }
    }

    public Object getValue() {
        return value;
    }

    public RolapMember getMember() {
        return member;
    }

    public boolean isMember() {
        return (member != null);
    }

    public boolean equals(Object other){
        if (!(other instanceof ColumnConstraint)) {
            return false;
        }
        if (member!= null) {
            return (member.equals(((ColumnConstraint)other).getMember()));
        }
        if (value != null) {
            return (value.equals(((ColumnConstraint)other).getValue()));
        }
        return (null == ((ColumnConstraint)other).getValue());
    }

    public int hashCode() {
        if (member!= null) {
            return member.hashCode();
        }
        if (value != null) {
            return value.hashCode();
        }
        return 0;
    }

}

⌨️ 快捷键说明

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