001 /* 002 // $Id: //open/mondrian/src/main/mondrian/olap/Cell.java#14 $ 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) 2001-2002 Kana Software, Inc. 007 // Copyright (C) 2001-2006 Julian Hyde and others 008 // All Rights Reserved. 009 // You must accept the terms of that agreement to use this software. 010 // 011 // jhyde, 6 August, 2001 012 */ 013 014 package mondrian.olap; 015 016 /** 017 * A <code>Cell</code> is an item in the grid of a {@link Result}. It is 018 * returned by {@link Result#getCell}. 019 * 020 * @author jhyde 021 * @since 6 August, 2001 022 * @version $Id: //open/mondrian/src/main/mondrian/olap/Cell.java#14 $ 023 */ 024 public interface Cell { 025 /** 026 * Returns the cell's raw value. This is useful for sending to further data 027 * processing, such as plotting a chart. 028 * 029 * <p> The value is never null. It may have various types:<ul> 030 * <li>if the cell is null, the value is {@link Util#nullValue};</li> 031 * <li>if the cell contains an error, the value is an instance of 032 * {@link Throwable};</li> 033 * <li>otherwise, the type of this value depends upon the type of 034 * measure: possible types include {@link java.math.BigDecimal}, 035 * {@link Double}, {@link Integer} and {@link String}.</li> 036 * </ul> 037 * 038 * @post return != null 039 * @post (return instanceof Throwable) == isError() 040 * @post (return instanceof Util.NullCellValue) == isNull() 041 */ 042 Object getValue(); 043 044 045 /** 046 * Return the cached formatted string, that survives an aggregate cache clear 047 */ 048 String getCachedFormatString(); 049 050 /** 051 * Returns the cell's value formatted according to the current format 052 * string, and locale-specific settings such as currency symbol. The 053 * current format string may itself be derived via an expression. For more 054 * information about format strings, see {@link mondrian.util.Format}. 055 */ 056 String getFormattedValue(); 057 058 /** 059 * Returns whether the cell's value is null. 060 */ 061 boolean isNull(); 062 063 /** 064 * Returns whether the cell's calculation returned an error. 065 */ 066 boolean isError(); 067 068 /** 069 * Returns a SQL query that, when executed, returns drill through data 070 * for this Cell. 071 * If the parameter extendedContext is true, then the 072 * query will include all the levels (i.e. columns) of non-constraining members 073 * (i.e. members which are at the "All" level). 074 * If the parameter extendedContext is false, the query will exclude 075 * the levels (coulmns) of non-constraining members. 076 * The result is null if the cell is based upon a calculated member. 077 * 078 */ 079 String getDrillThroughSQL(boolean extendedContext); 080 081 /** 082 * Returns true if drill through is possible for this Cell. 083 * Returns false if the Cell is based on a calculated measure. 084 * @return true if can drill through on this cell 085 */ 086 boolean canDrillThrough(); 087 088 /** 089 * Returns the number of fact table rows which contributed to this Cell. 090 */ 091 int getDrillThroughCount(); 092 093 /** 094 * Returns the value of a property. 095 * 096 * @param propertyName Case-sensitive property name 097 * @return Value of property 098 */ 099 Object getPropertyValue(String propertyName); 100 101 /** 102 * Returns the context member for a particular dimension. 103 * 104 * The member is defined as follows (note that there is always a 105 * member):<ul> 106 * 107 * <li>If the dimension appears on one of the visible axes, the context 108 * member is simply the member on the current row or column. 109 * 110 * <li>If the dimension appears in the slicer, the context member is the 111 * member of that dimension in the slier. 112 * 113 * <li>Otherwise, the context member is the default member of that 114 * dimension (usually the 'all' member).</ul> 115 */ 116 Member getContextMember(Dimension dimension); 117 } 118 119 // End Cell.java