Examples of ScalarFunction


Examples of com.google.visualization.datasource.query.scalarfunction.ScalarFunction

                scalarFunctionColumn.getAllScalarFunctionColumns();
        List<ScalarFunctionColumn> expectedScalarFunctionColumns =
                Lists.newArrayList();

        List<AbstractColumn> columns1 = Lists.newArrayList();
        ScalarFunction scalarFunction1 = TimeComponentExtractor.getInstance(
                TimeComponentExtractor.TimeComponent.MONTH);

        columns1.add(new SimpleColumn("col1"));
        columns1.add(new SimpleColumn("col2"));
        columns1.add(new AggregationColumn(new SimpleColumn("col3"),
View Full Code Here

Examples of com.google.visualization.datasource.query.scalarfunction.ScalarFunction

        expectedScalarFunctionColumns.add(innerScalarFunctionColumn);
        assertEquals(expectedScalarFunctionColumns, scalarFunctionColumns);
    }

    public void testGetValueType() {
        ScalarFunction scalarFunction = TimeComponentExtractor.getInstance(
                TimeComponentExtractor.TimeComponent.YEAR);
        DataTable table = new DataTable();
        table.addColumn(new ColumnDescription("dateCol", ValueType.DATE, "dateCol"));
        List<AbstractColumn> columns =
                Lists.newArrayList((AbstractColumn) new SimpleColumn("dateCol"));
View Full Code Here

Examples of com.google.visualization.datasource.query.scalarfunction.ScalarFunction

// An atomic abstract column descriptor, i.e., the same as abstract column,
// except it does not include arithmetic expressions like: c1+c2/c3*(c4+c5).
  final public AbstractColumn atomicAbstractColumnDescriptor() throws ParseException, InvalidQueryException {
  AggregationType aggregationType;
  ScalarFunction scalarFunction;
  String columnId;
  AbstractColumn column;
  ArrayList columns = new ArrayList();
  AbstractColumn result = null;
  Value value;
View Full Code Here

Examples of com.google.visualization.datasource.query.scalarfunction.ScalarFunction

    throw new Error("Missing return statement in function");
  }

// A scalar function, e.g., "datediff", "upper".
  final public ScalarFunction scalarFunction() throws ParseException {
  ScalarFunction result = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case KW_YEAR:
      jj_consume_token(KW_YEAR);
                 result = TimeComponentExtractor.getInstance(
          TimeComponentExtractor.TimeComponent.YEAR);
View Full Code Here

Examples of org.jboss.dashboard.function.ScalarFunction

    }

    public DataSet buildXYDataSet() {
        DataProperty domainProperty = getDomainProperty();
        DataProperty rangeProperty = getRangeProperty();
        ScalarFunction scalarFunction = getRangeScalarFunction();
        DataSet sourceDataSet = domainProperty.getDataSet();
        CodeBlockTrace trace = new BuildXYDataSetTrace(domainProperty, rangeProperty, scalarFunction).begin();
        try {
            if (domainProperty == null || domainProperty.getDomain() == null) return null;
            if (rangeProperty == null || scalarFunction == null) return null;

            // Group the original data set by the domain property.
            int pivot = sourceDataSet.getPropertyColumn(domainProperty);
            int range = sourceDataSet.getPropertyColumn(rangeProperty);
            int[] columns = new int[] {pivot, range};
            String[] functionCodes = new String[] {CountFunction.CODE, scalarFunction.getCode()};
            return sourceDataSet.groupBy(domainProperty, columns, functionCodes, intervalsSortCriteria, intervalsSortOrder);
        } finally {
            trace.end();
        }
    }
View Full Code Here

Examples of org.jboss.dashboard.function.ScalarFunction

        barChartDisplayer.setDomainProperty(propDept);
        barChartDisplayer.setRangeProperty(propAmount);

        // Calculate the data set to display.
        // Set the scalar function to apply for the calculations of the chart values.
        ScalarFunction scalarFunction = scalarFunctionManager.getScalarFunctionByCode(SumFunction.CODE);
        barChartDisplayer.setRangeScalarFunction(scalarFunction);
        DataSet xyDataSet = barChartDisplayer.buildXYDataSet();

        // Check the expected results matrix
        assertDataSetValues(xyDataSet, new String[][] {
View Full Code Here

Examples of org.jboss.dashboard.function.ScalarFunction

    public Command createCommand(String commandName) {

        // Scalar function commands.
        ScalarFunction[] scalarFunctions = DataDisplayerServices.lookup().getScalarFunctionManager().getAllScalarFunctions();
        for (int i = 0; i < scalarFunctions.length; i++) {
            ScalarFunction scalarFunction = scalarFunctions[i];
            String targetName = "dashboard_" + scalarFunction.getCode();
            if (commandName.equals(targetName)) return new ScalarFunctionCommand(targetName, scalarFunction);
        }

        // Command that gives access to the filter properties in the current dashboard.
        if (commandName.equals(DashboardFilterCommand.FILTER_MIN_VALUE)) return new DashboardFilterCommand(DashboardFilterCommand.FILTER_MIN_VALUE);
View Full Code Here

Examples of org.jboss.dashboard.function.ScalarFunction

    public void setMaxNumberOfIntervals(int maxNumberOfIntervals) {
        this.maxNumberOfIntervals = maxNumberOfIntervals;
    }

    public boolean isScalarFunctionSupported(String functionCode) {
        ScalarFunction function = DataProviderServices.lookup().getScalarFunctionManager().getScalarFunctionByCode(functionCode);
        if (function == null) return false;
        return isScalarFunctionSupported(function);
    }
View Full Code Here

Examples of org.jboss.dashboard.function.ScalarFunction

        for (Integer targetRow : rows) {
            targetValues.add(columnValues.get(targetRow));
        }

        ScalarFunctionManager scalarFunctionManager = DataProviderServices.lookup().getScalarFunctionManager();
        ScalarFunction function = scalarFunctionManager.getScalarFunctionByCode(functionCode);

        if (!CollectionUtils.exists(targetValues, NON_NULL_ELEMENTS)) {
            return new Double(0);
        } else {
            double value = function.scalar(targetValues);
            return new Double(value);
        }
    }
View Full Code Here

Examples of org.jboss.dashboard.function.ScalarFunction

                    _result.addRowValue(j, interval);
                }
            } else {
                // The values for other columns is a scalar function applied on the interval's values.
                ScalarFunctionManager scalarFunctionManager = DataProviderServices.lookup().getScalarFunctionManager();
                ScalarFunction function = scalarFunctionManager.getScalarFunctionByCode(functionCodes[j]);
                for (Interval interval : intervals) {
                    Double scalar = calculateScalar(interval, dataProp, function);
                    _result.addRowValue(j, scalar);
                }
                // After calculations, ensure the new property domain is numeric.
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.