Example usage for java.util List indexOf

List of usage examples for java.util List indexOf

Introduction

In this page you can find the example usage for java.util List indexOf.

Prototype

int indexOf(Object o);

Source Link

Document

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

Usage

From source file:de.bund.bfr.math.MultiVectorDiffFunction.java

public MultiVectorDiffFunction(List<String> formulas, List<String> dependentVariables, List<Double> initValues,
        List<List<String>> initParameters, List<String> parameters,
        List<Map<String, List<Double>>> variableValues, List<List<Double>> timeValues, String dependentVariable,
        String timeVariable, IntegratorFactory integrator, InterpolationFactory interpolator)
        throws ParseException {
    this.formulas = formulas;
    this.dependentVariables = dependentVariables;
    this.initValues = initValues;
    this.initParameters = initParameters;
    this.parameters = parameters;
    this.variableValues = variableValues;
    this.timeValues = timeValues;
    this.dependentVariable = dependentVariable;
    this.timeVariable = timeVariable;
    this.integrator = integrator;
    this.interpolator = interpolator;

    variableFunctions = variableValues.stream()
            .map(v -> MathUtils.createInterpolationFunctions(v, timeVariable, interpolator))
            .collect(Collectors.toList());
    dependentIndex = dependentVariables.indexOf(dependentVariable);
    parser = new Parser();
    functions = new ArrayList<>();

    for (String f : formulas) {
        functions.add(parser.parse(f));/*from w  w w .j a  va  2s.c o  m*/
    }
}

From source file:guineu.modules.dataanalysis.PCA.PCADataset.java

public PCADataset(ProjectionPlotParameters parameters) {

    this.parameters = parameters;

    this.xAxisPC = parameters.getParameter(ProjectionPlotParameters.xAxisComponent).getValue();
    this.yAxisPC = parameters.getParameter(ProjectionPlotParameters.yAxisComponent).getValue();

    this.selectedSamples = parameters.getParameter(ProjectionPlotParameters.dataFiles).getValue();
    this.selectedRows = parameters.getParameter(ProjectionPlotParameters.rows).getValue();

    this.showLoadings = parameters.getParameter(ProjectionPlotParameters.showLoadings).getValue();

    this.coloringType = parameters.getParameter(ProjectionPlotParameters.coloringType).getValue();
    this.components = parameters.getParameter(ProjectionPlotParameters.components).getValue();

    datasetTitle = "Principal component analysis";

    // Determine groups for selected raw data files
    groupsForSelectedRawDataFiles = new int[selectedSamples.length];

    if (coloringType == ColoringType.NOCOLORING) {
        // All files to a single group
        for (int ind = 0; ind < selectedSamples.length; ind++) {
            groupsForSelectedRawDataFiles[ind] = 0;
        }//from   w w  w  .jav a2 s  . co m

        numberOfGroups = 1;
    } else if (coloringType == ColoringType.COLORBYFILE) {
        // Each file to own group
        for (int ind = 0; ind < selectedSamples.length; ind++) {
            groupsForSelectedRawDataFiles[ind] = ind;
        }

        numberOfGroups = selectedSamples.length;
    } else {
        List<Object> availableParameterValues = new ArrayList<Object>();
        String parameter = coloringType.toString();
        parameter = parameter.replace("Color by ", "");
        for (String rawDataFile : selectedSamples) {
            String paramValue = GuineuCore.getDesktop().getSelectedDataFiles()[0]
                    .getParametersValue(rawDataFile, parameter);
            if (!availableParameterValues.contains(paramValue)) {
                availableParameterValues.add(paramValue);
            }
        }

        for (int ind = 0; ind < selectedSamples.length; ind++) {
            String paramValue = GuineuCore.getDesktop().getSelectedDataFiles()[0]
                    .getParametersValue(selectedSamples[ind], parameter);
            groupsForSelectedRawDataFiles[ind] = availableParameterValues.indexOf(paramValue);
        }
        parameterValuesForGroups = availableParameterValues.toArray();

        numberOfGroups = parameterValuesForGroups.length;

        parameterValuesForGroups = availableParameterValues.toArray();

        numberOfGroups = parameterValuesForGroups.length;
    }
}

From source file:org.jahia.modules.modulemanager.flow.ModuleManagementFlowHandler.java

private List<String> getMissingDependenciesFrom(List<String> deps, List<String> providedDependencies) {
    List<String> missingDeps = new ArrayList<String>(deps.size());
    for (String dep : deps) {
        if (providedDependencies != null && providedDependencies.indexOf(dep) != -1) {
            // we have the dependency
            continue;
        }//  w  w  w. j ava  2 s  . c om
        if (templateManagerService.getTemplatePackageById(dep) == null
                && templateManagerService.getTemplatePackage(dep) == null) {
            missingDeps.add(dep);
        }
    }
    return missingDeps;
}

From source file:com.haulmont.cuba.web.app.folders.CubaFoldersPane.java

protected void updateFolders(List<AppFolder> reloadedFolders) {
    @SuppressWarnings("unchecked")
    List<AppFolder> folders = new ArrayList(appFoldersTree.getItemIds());
    for (AppFolder folder : reloadedFolders) {
        int index = reloadedFolders.indexOf(folder);
        AppFolder f = folders.get(index);
        if (f != null) {
            f.setItemStyle(folder.getItemStyle());
            f.setQuantity(folder.getQuantity());
        }// w ww.  j  av  a 2 s .c  o  m
        setFolderTreeItemCaption(appFoldersTree, folder);
    }
}

From source file:edu.ku.brc.specify.tools.webportal.BuildSearchIndex2.java

License:asdf

public List<String> getDbFieldInfoTypes() {
    List<String> result = new ArrayList<String>();
    for (DBTableInfo tbl : DBTableIdMgr.getInstance().getTables()) {
        for (DBFieldInfo fld : tbl.getFields()) {
            if (result.indexOf(fld.getType()) == -1) {
                result.add(fld.getType());
            }/*from  w ww.  jav  a  2s  .com*/
        }
    }
    for (String r : result) {
        System.out.println(r);
    }
    return result;

}

From source file:com.vmware.photon.controller.deployer.xenon.task.RegisterAuthClientTaskService.java

/**
 * This method modifies a URI by removing a set of query parameters from the URI and editing the scope parameter to
 * include ID_GROUPS. The parameters that are removed are session related and will be set by the UI as needed.
 *///from  ww w  .  j av a  2 s  . c o  m
private String parseURL(String url, String[] removeParams) throws URISyntaxException {
    if (StringUtils.isBlank(url)) {
        return url;
    }

    // Get the query parameters from the URL and return if empty
    URI uri = new URI(url);
    String urlQuery = uri.getQuery();
    if (StringUtils.isBlank(urlQuery)) {
        return url;
    }

    // Remove the query parameters specified in removeParams
    List<String> queryParams = Arrays.asList(urlQuery.split("&"));
    queryParams = queryParams.stream().filter(param -> {
        for (String removeParam : removeParams) {
            if (param.startsWith(removeParam + "=")) {
                return false;
            }
        }
        return true;
    }).collect(Collectors.toList());

    // Edit the scope query parameter to add id_groups to it. id_groups requests that the groups from the id token are
    // included.
    for (String parameter : queryParams) {
        if (parameter.startsWith(SCOPE + "=")) {
            queryParams.set(queryParams.indexOf(parameter), parameter + "+" + ID_GROUPS);
        }
    }

    // Append the modified query parameters to the base URL and return the new URL
    String baseUrl = url.split("\\?")[0];
    if (queryParams.size() > 0) {
        baseUrl = baseUrl + "?" + StringUtils.join(queryParams, "&");
    }
    return baseUrl;
}

From source file:de.tudarmstadt.ukp.clarin.webanno.tsv.WebannoTsv3Writer.java

private void updateUnitLists(List<AnnotationUnit> tmpUnits, AnnotationUnit unit, AnnotationUnit newUnit) {
    if (!tmpUnits.contains(newUnit)) {
        newUnit.isSubtoken = true;//  w w  w  .j  av  a2 s.  c  o m
        // is this sub-token already there
        if (!tmpUnits.contains(newUnit)) {
            tmpUnits.add(tmpUnits.indexOf(unit) + 1, newUnit);
            subUnits.put(unit, subUnits.getOrDefault(unit, 0) + 1);
            unitsLineNumber.put(newUnit, unitsLineNumber.get(unit) + "." + subUnits.get(unit));
        }
    }
}

From source file:org.apache.unomi.services.services.SegmentServiceImpl.java

private boolean checkSegmentDeletionImpact(Condition condition, String segmentToDeleteId) {
    if (condition != null) {
        @SuppressWarnings("unchecked")
        final List<Condition> subConditions = (List<Condition>) condition.getParameter("subConditions");
        if (subConditions != null) {
            for (Condition subCondition : subConditions) {
                if (checkSegmentDeletionImpact(subCondition, segmentToDeleteId)) {
                    return true;
                }//from   w  ww  .  j av a  2s .  c om
            }
        } else if ("profileSegmentCondition".equals(condition.getConditionTypeId())) {
            @SuppressWarnings("unchecked")
            final List<String> referencedSegmentIds = (List<String>) condition.getParameter("segments");

            if (referencedSegmentIds.indexOf(segmentToDeleteId) >= 0) {
                return true;
            }
        }
    }
    return false;
}

From source file:org.apache.unomi.services.services.SegmentServiceImpl.java

/**
 * Return an updated condition that do not contain a condition on the segmentId anymore
 * it's remove the unnecessary boolean condition (if a condition is the only one of a boolean the boolean will be remove and the subcondition returned)
 * it's return null when there is no more condition after (if the condition passed was only a segment condition on the segmentId)
 * @param condition the condition to update
 * @param segmentId the segment id to remove in the condition
 * @return updated condition//from  www.j a va  2 s  . c  o  m
 */
private Condition updateSegmentDependentCondition(Condition condition, String segmentId) {
    if ("booleanCondition".equals(condition.getConditionTypeId())) {
        @SuppressWarnings("unchecked")
        final List<Condition> subConditions = (List<Condition>) condition.getParameter("subConditions");
        List<Condition> updatedSubConditions = new LinkedList<>();
        for (Condition subCondition : subConditions) {
            Condition updatedCondition = updateSegmentDependentCondition(subCondition, segmentId);
            if (updatedCondition != null) {
                updatedSubConditions.add(updatedCondition);
            }
        }
        if (!updatedSubConditions.isEmpty()) {
            if (updatedSubConditions.size() == 1) {
                return updatedSubConditions.get(0);
            } else {
                condition.setParameter("subConditions", updatedSubConditions);
                return condition;
            }
        } else {
            return null;
        }
    } else if ("profileSegmentCondition".equals(condition.getConditionTypeId())) {
        @SuppressWarnings("unchecked")
        final List<String> referencedSegmentIds = (List<String>) condition.getParameter("segments");
        if (referencedSegmentIds.indexOf(segmentId) >= 0) {
            referencedSegmentIds.remove(segmentId);
            if (referencedSegmentIds.isEmpty()) {
                return null;
            } else {
                condition.setParameter("segments", referencedSegmentIds);
            }
        }
    }
    return condition;
}

From source file:com.twinsoft.convertigo.beans.core.RequestableStep.java

private void insertOrderedVariable(Variable variable, Long after) {
    List<Long> ordered = orderedVariables.get(0);
    int size = ordered.size();

    if (ordered.contains(variable.priority))
        return;/*from ww w .  j  a  v  a2  s .  c o  m*/

    if (after == null) {
        after = new Long(0);
        if (size > 0)
            after = ordered.get(ordered.size() - 1);
    }

    int order = ordered.indexOf(after);
    ordered.add(order + 1, variable.priority);
    hasChanged = true;
}