Examples of SumDoubleAggregator


Examples of co.nubetech.crux.server.functions.SumDoubleAggregator

public class TestFunctionUtil {
   
  @Test
  public void testApplyFunctionsAggregateFirst() throws CruxException{
    Stack<CruxFunction> xFnStack = new Stack<CruxFunction>();
    SumDoubleAggregator summer = new SumDoubleAggregator();
    xFnStack.push(summer);
    xFnStack.push(new Ceil());
    byte[] value = Bytes.toBytes(new Double(54.5d));
    FunctionUtil.applyAggregateFunctions(value, xFnStack);
    byte[] value1 = Bytes.toBytes(new Double(5.25d));
    FunctionUtil.applyAggregateFunctions(value1, xFnStack);
    assertEquals(59.75d, summer.getAggregate());
  }
View Full Code Here

Examples of co.nubetech.crux.server.functions.SumDoubleAggregator

 
  @Test
  public void testApplyFunctionsNonAggregateFirst() throws CruxException{
    GroupingAggregationImpl impl = new GroupingAggregationImpl();
    Stack<CruxFunction> xFnStack = new Stack<CruxFunction>();
    SumDoubleAggregator summer = new SumDoubleAggregator();
    xFnStack.push(new Ceil());
    xFnStack.push(summer);
    byte[] value = Bytes.toBytes(new Double(54.5d));
    FunctionUtil.applyAggregateFunctions(value, xFnStack);
    byte[] value1 = Bytes.toBytes(new Double(5.25d));
    FunctionUtil.applyAggregateFunctions(value1, xFnStack);
    assertEquals(61d, summer.getAggregate());
  }
View Full Code Here

Examples of co.nubetech.crux.server.functions.SumDoubleAggregator

  }
 
  @Test
  public void testApplyFunctionsOnlyAggregate() throws CruxException{
    Stack<CruxFunction> xFnStack = new Stack<CruxFunction>();
    SumDoubleAggregator summer = new SumDoubleAggregator();
    xFnStack.push(summer);
    byte[] value = Bytes.toBytes(new Double(54.5d));
    FunctionUtil.applyAggregateFunctions(value, xFnStack);
    byte[] value1 = Bytes.toBytes(new Double(5.25d));
    FunctionUtil.applyAggregateFunctions(value1, xFnStack);
    assertEquals(59.75d, summer.getAggregate());
  }
View Full Code Here

Examples of co.nubetech.crux.server.functions.SumDoubleAggregator

  }
 
  @Test
  public void testGetSemiAggregatedResultNonAggregateFirst() throws CruxException{
    Stack<CruxFunction> xFnStack = new Stack<CruxFunction>();
    SumDoubleAggregator summer = new SumDoubleAggregator();
    summer.aggregate(Bytes.toBytes(new Double(54.5d)));
    xFnStack.push(new Ceil());
    xFnStack.push(summer);
    assertEquals(54.5d, FunctionUtil.getSemiAggregatedResult(xFnStack));
  }
View Full Code Here

Examples of co.nubetech.crux.server.functions.SumDoubleAggregator

  }
 
  @Test
  public void testGetSemiAggResultAggregateFirst() throws CruxException{
    Stack<CruxFunction> xFnStack = new Stack<CruxFunction>();
    SumDoubleAggregator summer = new SumDoubleAggregator();
    summer.aggregate(Bytes.toBytes(new Double(54.5d)));
    xFnStack.push(summer);
    xFnStack.push(new Ceil());
    assertEquals(54.5d, FunctionUtil.getSemiAggregatedResult(xFnStack));
  }
View Full Code Here

Examples of co.nubetech.crux.server.functions.SumDoubleAggregator

 
  @Test
  public void testGetSimpleFunctionResultWithAggFn() throws CruxException{
    //getSimpleFunctionResult
    Stack<CruxFunction> xFnStack = new Stack<CruxFunction>();
    xFnStack.push(new SumDoubleAggregator());
    xFnStack.push(new Ceil());   
    System.out.println("Value is " + FunctionUtil.getSimpleFunctionResult(Bytes.toBytes(1234.5d),
        xFnStack));
    assertEquals(1235.0d, FunctionUtil.getSimpleFunctionResult(Bytes.toBytes(1234.5d),
        xFnStack));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.