001 /* 002 // $Id: //open/mondrian/src/main/mondrian/rolap/agg/MemberColumnPredicate.java#4 $ 003 // This software is subject to the terms of the Common Public License 004 // Agreement, available at the following URL: 005 // http://www.opensource.org/licenses/cpl.html. 006 // Copyright (C) 2006-2007 Julian Hyde 007 // All Rights Reserved. 008 // You must accept the terms of that agreement to use this software. 009 */ 010 package mondrian.rolap.agg; 011 012 import mondrian.rolap.RolapMember; 013 import mondrian.rolap.RolapStar; 014 import mondrian.rolap.StarColumnPredicate; 015 016 import java.util.List; 017 018 /** 019 * Column constraint defined by a member. 020 * 021 * @author jhyde 022 * @version $Id: //open/mondrian/src/main/mondrian/rolap/agg/MemberColumnPredicate.java#4 $ 023 * @since Mar 16, 2006 024 */ 025 public class MemberColumnPredicate extends ValueColumnPredicate { 026 private final RolapMember member; 027 028 /** 029 * Creates a MemberColumnPredicate 030 * 031 * @param column Constrained column 032 * @param member Member to constrain column to; must not be null 033 */ 034 public MemberColumnPredicate(RolapStar.Column column, RolapMember member) { 035 super(column, member.getKey()); 036 this.member = member; 037 } 038 039 // for debug 040 public String toString() { 041 return member.getUniqueName(); 042 } 043 044 public List<RolapStar.Column> getConstrainedColumnList() { 045 return super.getConstrainedColumnList(); 046 } 047 048 /** 049 * Returns the <code>Member</code>. 050 * 051 * @return Returns the <code>Member</code>, not null. 052 */ 053 public RolapMember getMember() { 054 return member; 055 } 056 057 public boolean equals(Object other) { 058 if (!(other instanceof MemberColumnPredicate)) { 059 return false; 060 } 061 final MemberColumnPredicate that = (MemberColumnPredicate) other; 062 return member.equals(that.getMember()); 063 } 064 065 public int hashCode() { 066 return member.hashCode(); 067 } 068 069 public void describe(StringBuilder buf) { 070 buf.append(member.getUniqueName()); 071 } 072 073 public StarColumnPredicate cloneWithColumn(RolapStar.Column column) { 074 return new MemberColumnPredicate(column, member); 075 } 076 } 077 078 // End MemberColumnPredicate.java