public DataDrivenParameterArray calculateParameterArray()

in gepard-core/src/main/java/com/epam/gepard/datadriven/feeders/BruteMultiplierDataFeeder.java [62:92]


    public DataDrivenParameterArray calculateParameterArray(final String className, final DataDrivenParameterArray inputParameterArray) {
        //need to have input array
        DataDrivenParameterArray transferArray = inputParameterArray; //need to change it, as we cannot touch the input array
        if (transferArray == null) { // we do not have, so then we have to simulate the data driven approach
            transferArray = new DataDrivenParameterArray();
            String[] parameterNames = new String[1];
            parameterNames[0] = "MULTIPLIER";
            transferArray.setParameterNames(parameterNames);
            String[] newRow = new String[1];
            newRow[0] = "";
            transferArray.put(0, newRow); //put the only row into the input array
        } // now we have the transfer parameter array, for sure

        //recalculate the parent array
        DataDrivenParameterArray newArray = new DataDrivenParameterArray();
        Integer arrayKey = 0; //this will be our new key
        for (int i = 1; i <= multiplier; i++) { //as this feeder is a multiplier
            //iterate through to old array and add the same value to every row
            for (String[] original : transferArray.values()) {
                String[] newRow = new String[original.length];
                System.arraycopy(original, 0, newRow, 0, original.length);
                newRow[0] = original[0] + " - #" + i;
                newArray.put(arrayKey, newRow); //put the new row into the new array
                arrayKey++; //prepare the next key
            }
        }

        //plus we should recreate the parameter names
        newArray.setParameterNames(transferArray.getParameterNames());
        return newArray;
    }