public static Object getResultByApplyingAllFunctions(Object value, Stack<CruxFunction> functions) throws CruxException {
Object returnVal = value;
for (CruxFunction fn : functions) {
if (fn.isAggregate()) {
CruxAggregator aggregator = (CruxAggregator) fn;
aggregator.aggregate(returnVal);
returnVal = ((CruxAggregator)fn).getAggregate();
}
else {
returnVal = ((CruxNonAggregator)fn).execute(returnVal);
}