<commit_before>
/*******************************************************************************
 * Copyright (c) 2004, 2005 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/
package org.eclipse.birt.data.engine.olap.impl.query;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.olap.OLAPException;
import javax.olap.cursor.Blob;
import javax.olap.cursor.Clob;
import javax.olap.cursor.CubeCursor;
import javax.olap.cursor.Date;
import javax.olap.cursor.RowDataMetaData;
import javax.olap.cursor.Time;
import javax.olap.cursor.Timestamp;

import org.eclipse.birt.core.data.DataTypeUtil;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.script.JavascriptEvalUtil;
import org.eclipse.birt.data.engine.api.IBaseExpression;
import org.eclipse.birt.data.engine.api.IBinding;
import org.eclipse.birt.data.engine.core.DataException;
import org.eclipse.birt.data.engine.olap.api.ICubeCursor;
import org.eclipse.birt.data.engine.olap.api.query.ICubeQueryDefinition;
import org.eclipse.birt.data.engine.olap.script.JSCubeBindingObject;
import org.eclipse.birt.data.engine.olap.script.OLAPExpressionCompiler;
import org.eclipse.birt.data.engine.olap.util.OlapQueryUtil;
import org.eclipse.birt.data.engine.script.ScriptEvalUtil;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;


/**
 * 
 */

public class CubeCursorImpl implements ICubeCursor
{	
	private CubeCursor cursor;
	private Scriptable scope;
	private ICubeQueryDefinition queryDefn;
	private HashMap bindingMap, dataTypeMap;
	
	public CubeCursorImpl ( CubeCursor cursor, Scriptable scope, ICubeQueryDefinition queryDefn ) throws DataException
	{
		this.cursor = cursor;
		this.scope = scope;
		this.queryDefn = queryDefn;
		
		OlapQueryUtil.validateBinding( queryDefn, false );
		
		this.bindingMap = new HashMap( );
		this.dataTypeMap = new HashMap( );
		for ( int i = 0; i < this.queryDefn.getBindings( ).size( ); i++ )
		{
			IBinding binding = (IBinding) this.queryDefn.getBindings( ).get( i );
			if ( binding.getAggrFunction( ) == null )
			{
				this.bindingMap.put( binding.getBindingName( ),
						binding.getExpression( ) );
				OLAPExpressionCompiler.compile( binding.getExpression( ) );
			}
			dataTypeMap.put( binding.getBindingName( ),
					Integer.valueOf( binding.getDataType( ) ) );
		}
		
		this.scope.put( "data", this.scope, new JSCubeBindingObject( this ));
	}
	
	public List getOrdinateEdge( ) throws OLAPException
	{<commit_msg>CheckiN:Fix bugzilla bug 193431org.eclipse.birt.data has compile error in daily build 20070621-0630<commit_after>
/*******************************************************************************
 * Copyright (c) 2004, 2005 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/
package org.eclipse.birt.data.engine.olap.impl.query;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.olap.OLAPException;
import javax.olap.cursor.Blob;
import javax.olap.cursor.Clob;
import javax.olap.cursor.CubeCursor;
import javax.olap.cursor.Date;
import javax.olap.cursor.RowDataMetaData;
import javax.olap.cursor.Time;
import javax.olap.cursor.Timestamp;

import org.eclipse.birt.core.data.DataTypeUtil;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.script.JavascriptEvalUtil;
import org.eclipse.birt.data.engine.api.IBaseExpression;
import org.eclipse.birt.data.engine.api.IBinding;
import org.eclipse.birt.data.engine.core.DataException;
import org.eclipse.birt.data.engine.olap.api.ICubeCursor;
import org.eclipse.birt.data.engine.olap.api.query.ICubeQueryDefinition;
import org.eclipse.birt.data.engine.olap.script.JSCubeBindingObject;
import org.eclipse.birt.data.engine.olap.script.OLAPExpressionCompiler;
import org.eclipse.birt.data.engine.olap.util.OlapQueryUtil;
import org.eclipse.birt.data.engine.script.ScriptEvalUtil;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;


/**
 * 
 */

public class CubeCursorImpl implements ICubeCursor
{	
	private CubeCursor cursor;
	private Scriptable scope;
	private ICubeQueryDefinition queryDefn;
	private HashMap bindingMap, dataTypeMap;
	
	public CubeCursorImpl ( CubeCursor cursor, Scriptable scope, ICubeQueryDefinition queryDefn ) throws DataException
	{
		this.cursor = cursor;
		this.scope = scope;
		this.queryDefn = queryDefn;
		
		OlapQueryUtil.validateBinding( queryDefn, false );
		
		this.bindingMap = new HashMap( );
		this.dataTypeMap = new HashMap( );
		for ( int i = 0; i < this.queryDefn.getBindings( ).size( ); i++ )
		{
			IBinding binding = (IBinding) this.queryDefn.getBindings( ).get( i );
			if ( binding.getAggrFunction( ) == null )
			{
				this.bindingMap.put( binding.getBindingName( ),
						binding.getExpression( ) );
				OLAPExpressionCompiler.compile( binding.getExpression( ) );
			}
			dataTypeMap.put( binding.getBindingName( ),
					new Integer( binding.getDataType( ) ) );
		}
		
		this.scope.put( "data", this.scope, new JSCubeBindingObject( this ));
	}
	
	public List getOrdinateEdge( ) throws OLAPException
	{
{'fraction_non_alphanumeric': 0.15570821066404972, 'fraction_numerical': 0.007196597971867844, 'mean_word_length': 4.965853658536585, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2658957', 'n_tokens_mistral': 1997, 'n_tokens_neox': 1844, 'n_words': 383}