All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prerna.algorithm.impl.RoundUpReactor Maven / Gradle / Ivy

There is a newer version: 4.2.2
Show newest version
package prerna.algorithm.impl;

import java.util.Iterator;
import java.util.Map;
import java.util.Vector;

import prerna.algorithm.api.ITableDataFrame;
import prerna.ds.ExpressionIterator;
import prerna.sablecc.MathReactor;
import prerna.sablecc.PKQLEnum;
import prerna.sablecc.PKQLRunner.STATUS;

public class RoundUpReactor extends MathReactor {
	
	public RoundUpReactor() {
		setMathRoutine("Ceil");
	}
	
	@Override
	public Iterator process(){
		modExpression();
		Vector columns=  (Vector ) myStore.get(PKQLEnum.COL_DEF);
		String[] columnArray = convertVectorToArray(columns);
		Iterator itr = getTinkerData(columns, (ITableDataFrame)myStore.get("G") , false);
				
		
		Map options = (Map) myStore.get(PKQLEnum.MAP_OBJ);
		double significantDigit = Integer.parseInt(options.get("CONDITION1") + "");
		double digit = Math.pow(10, significantDigit);
		String script = "Math.ceil("+columnArray[0] +"* "+ digit+")/" + digit;
					
		ExpressionIterator expItr =  new ExpressionIterator(itr, columnArray, script);
		String pkql = myStore.get(whoAmI).toString();
		myStore.put(pkql, expItr);
		myStore.put("STATUS",STATUS.SUCCESS);
			
		return expItr;
	
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy