当前位置: 首页>>代码示例>>Java>>正文


Java ValueDataUtil.plus方法代码示例

本文整理汇总了Java中org.pentaho.di.core.row.ValueDataUtil.plus方法的典型用法代码示例。如果您正苦于以下问题:Java ValueDataUtil.plus方法的具体用法?Java ValueDataUtil.plus怎么用?Java ValueDataUtil.plus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.row.ValueDataUtil的用法示例。


在下文中一共展示了ValueDataUtil.plus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addCumulativeSums

import org.pentaho.di.core.row.ValueDataUtil; //导入方法依赖的package包/类
private void addCumulativeSums(Object[] row) throws KettleValueException {

		// We need to adjust this row with cumulative averages?
        //
        for (int i=0;i<data.cumulativeSumSourceIndexes.size();i++)
        {
        	int sourceIndex = data.cumulativeSumSourceIndexes.get(i);
        	Object previousTarget = data.previousSums[i];
        	Object sourceValue = row[sourceIndex];
        	
        	int targetIndex = data.cumulativeSumTargetIndexes.get(i);
        	
        	ValueMetaInterface sourceMeta = data.inputRowMeta.getValueMeta(sourceIndex);
    		ValueMetaInterface targetMeta = data.outputRowMeta.getValueMeta(targetIndex);

    		// If the first values where null, or this is the first time around, just take the source value...
    		//
        	if (targetMeta.isNull(previousTarget))
        	{
        		row[targetIndex]=sourceMeta.convertToNormalStorageType(sourceValue);
        	}
        	else
        	{
        		// If the source value is null, just take the previous target value
        		//
        		if (sourceMeta.isNull(sourceValue))
        		{
        			row[targetIndex] = previousTarget;
        		}
        		else
        		{
            		row[targetIndex] = ValueDataUtil.plus(targetMeta, data.previousSums[i], sourceMeta, row[sourceIndex]);
        		}
        	}
        	data.previousSums[i] = row[targetIndex];
        }

	}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:39,代码来源:GroupBy.java

示例2: addCumulativeSums

import org.pentaho.di.core.row.ValueDataUtil; //导入方法依赖的package包/类
private void addCumulativeSums( Object[] row ) throws KettleValueException {

    // We need to adjust this row with cumulative averages?
    //
    for ( int i = 0; i < data.cumulativeSumSourceIndexes.size(); i++ ) {
      int sourceIndex = data.cumulativeSumSourceIndexes.get( i );
      Object previousTarget = data.previousSums[ i ];
      Object sourceValue = row[ sourceIndex ];

      int targetIndex = data.cumulativeSumTargetIndexes.get( i );

      ValueMetaInterface sourceMeta = data.inputRowMeta.getValueMeta( sourceIndex );
      ValueMetaInterface targetMeta = data.outputRowMeta.getValueMeta( targetIndex );

      // If the first values where null, or this is the first time around, just take the source value...
      //
      if ( targetMeta.isNull( previousTarget ) ) {
        row[ targetIndex ] = sourceMeta.convertToNormalStorageType( sourceValue );
      } else {
        // If the source value is null, just take the previous target value
        //
        if ( sourceMeta.isNull( sourceValue ) ) {
          row[ targetIndex ] = previousTarget;
        } else {
          row[ targetIndex ] = ValueDataUtil.plus( targetMeta, data.previousSums[ i ], sourceMeta, row[ sourceIndex ] );
        }
      }
      data.previousSums[ i ] = row[ targetIndex ];
    }

  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:32,代码来源:GroupBy.java

示例3: addCumulativeAverages

import org.pentaho.di.core.row.ValueDataUtil; //导入方法依赖的package包/类
private void addCumulativeAverages(Object[] row) throws KettleValueException {

		// We need to adjust this row with cumulative sums
        //
        for (int i=0;i<data.cumulativeAvgSourceIndexes.size();i++)
        {
        	int sourceIndex = data.cumulativeAvgSourceIndexes.get(i);
        	Object previousTarget = data.previousAvgSum[i];
        	Object sourceValue = row[sourceIndex];
        	
        	int targetIndex = data.cumulativeAvgTargetIndexes.get(i);
        	
        	ValueMetaInterface sourceMeta = data.inputRowMeta.getValueMeta(sourceIndex);
    		ValueMetaInterface targetMeta = data.outputRowMeta.getValueMeta(targetIndex);

    		// If the first values where null, or this is the first time around, just take the source value...
    		//
    		Object sum = null;
    		
        	if (targetMeta.isNull(previousTarget))
        	{
        		sum=sourceMeta.convertToNormalStorageType(sourceValue);
        	}
        	else
        	{
        		// If the source value is null, just take the previous target value
        		//
        		if (sourceMeta.isNull(sourceValue))
        		{
        			sum = previousTarget;
        		}
        		else
        		{
        			if (sourceMeta.isInteger())
        			{
        				sum = ValueDataUtil.plus(data.valueMetaInteger, data.previousAvgSum[i], sourceMeta, row[sourceIndex]);
        			}
        			else
        			{
        				sum = ValueDataUtil.plus(targetMeta, data.previousAvgSum[i], sourceMeta, row[sourceIndex]);
        			}
        		}
        	}
        	data.previousAvgSum[i] = sum;

        	if (!sourceMeta.isNull(sourceValue)) data.previousAvgCount[i]++;
        	
        	if (sourceMeta.isInteger()) {
        		// Change to number as the exception
        		//
        		if (sum==null)
        		{
        			row[targetIndex] = null;
        		}
        		else 
        		{
        			row[targetIndex] = new Double( ((Long)sum).doubleValue() / data.previousAvgCount[i] );
        		}
        	}
        	else
        	{
        		row[targetIndex] = ValueDataUtil.divide(targetMeta, sum, data.valueMetaInteger, data.previousAvgCount[i]);
        	}
        }

	}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:67,代码来源:GroupBy.java

示例4: addCumulativeAverages

import org.pentaho.di.core.row.ValueDataUtil; //导入方法依赖的package包/类
private void addCumulativeAverages( Object[] row ) throws KettleValueException {

    // We need to adjust this row with cumulative sums
    //
    for ( int i = 0; i < data.cumulativeAvgSourceIndexes.size(); i++ ) {
      int sourceIndex = data.cumulativeAvgSourceIndexes.get( i );
      Object previousTarget = data.previousAvgSum[ i ];
      Object sourceValue = row[ sourceIndex ];

      int targetIndex = data.cumulativeAvgTargetIndexes.get( i );

      ValueMetaInterface sourceMeta = data.inputRowMeta.getValueMeta( sourceIndex );
      ValueMetaInterface targetMeta = data.outputRowMeta.getValueMeta( targetIndex );

      // If the first values where null, or this is the first time around, just take the source value...
      //
      Object sum = null;

      if ( targetMeta.isNull( previousTarget ) ) {
        sum = sourceMeta.convertToNormalStorageType( sourceValue );
      } else {
        // If the source value is null, just take the previous target value
        //
        if ( sourceMeta.isNull( sourceValue ) ) {
          sum = previousTarget;
        } else {
          if ( sourceMeta.isInteger() ) {
            sum = ValueDataUtil.plus( data.valueMetaInteger, data.previousAvgSum[ i ], sourceMeta, row[ sourceIndex ] );
          } else {
            sum = ValueDataUtil.plus( targetMeta, data.previousAvgSum[ i ], sourceMeta, row[ sourceIndex ] );
          }
        }
      }
      data.previousAvgSum[ i ] = sum;

      if ( !sourceMeta.isNull( sourceValue ) ) {
        data.previousAvgCount[ i ]++;
      }

      if ( sourceMeta.isInteger() ) {
        // Change to number as the exception
        //
        if ( sum == null ) {
          row[ targetIndex ] = null;
        } else {
          row[ targetIndex ] = new Double( ( (Long) sum ).doubleValue() / data.previousAvgCount[ i ] );
        }
      } else {
        row[ targetIndex ] = ValueDataUtil.divide( targetMeta, sum, data.valueMetaInteger, data.previousAvgCount[ i ] );
      }
    }

  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:54,代码来源:GroupBy.java


注:本文中的org.pentaho.di.core.row.ValueDataUtil.plus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。