001/* 002// This software is subject to the terms of the Eclipse Public License v1.0 003// Agreement, available at the following URL: 004// http://www.eclipse.org/legal/epl-v10.html. 005// You must accept the terms of that agreement to use this software. 006// 007// Copyright (C) 2011-2012 Pentaho and others 008// All Rights Reserved. 009*/ 010package mondrian.rolap.agg; 011 012import mondrian.util.Pair; 013 014import java.util.*; 015 016/** 017 * Implementation of a segment body which stores the data inside 018 * a dense array of Java objects. 019 * 020 * @author LBoudreau 021 */ 022class DenseObjectSegmentBody extends AbstractSegmentBody { 023 private static final long serialVersionUID = -3558427982849392173L; 024 025 private final Object[] values; 026 027 /** 028 * Creates a DenseObjectSegmentBody. 029 * 030 * <p>Stores the given array of cell values; caller must not modify it 031 * afterwards.</p> 032 * 033 * @param values Cell values 034 * @param axes Axes 035 */ 036 DenseObjectSegmentBody( 037 Object[] values, 038 List<Pair<SortedSet<Comparable>, Boolean>> axes) 039 { 040 super(axes); 041 this.values = values; 042 } 043 044 @Override 045 public Object getValueArray() { 046 return values; 047 } 048 049 @Override 050 protected Object getObject(int i) { 051 return values[i]; 052 } 053 054 @Override 055 protected int getSize() { 056 return values.length; // TODO: subtract number of nulls? 057 } 058} 059 060// End DenseObjectSegmentBody.java