Package org.jboss.dashboard.function

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


        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

    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

    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

        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

                    _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

                DataProperty _prop = dataProp.cloneProperty();
                _result.addProperty(_prop, j);

                // 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

    public DataSet buildXYDataSet() {
        DataSet targetDataSet = null;
        DataProperty domainProperty = getDomainProperty();
        DataProperty rangeProperty = getRangeProperty();
        ScalarFunction scalarFunction = getRangeScalarFunction();
        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. Thus the scalar function is applied to the range values.
            DataSet sourceDataSet = domainProperty.getDataSet();
            List<DataProperty> targetDataProps = Arrays.asList(new DataProperty[]{domainProperty, rangeProperty});
            List<String> targetFunctionCodes = Arrays.asList(new String[]{CountFunction.CODE, scalarFunction.getCode()});
            targetDataSet = sourceDataSet.groupBy(domainProperty, targetDataProps, targetFunctionCodes);

            // Sort the resulting data set according to the sort policy specified.
            if (intervalsSortOrder != INTERVALS_SORT_ORDER_NONE) {
                DataSetComparator comp = new DataSetComparator();
View Full Code Here

    }

    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

    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

TOP

Related Classes of org.jboss.dashboard.function.ScalarFunction

Copyright © 2018 www.massapicom. 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.