Example usage for org.apache.commons.lang ArrayUtils contains

List of usage examples for org.apache.commons.lang ArrayUtils contains

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils contains.

Prototype

public static boolean contains(boolean[] array, boolean valueToFind) 

Source Link

Document

Checks if the value is in the given array.

Usage

From source file:eu.sofia.adk.common.xsd.JavaDatatype.java

/**
 * Determines if the datatype is an integer datatype 
 * @param datatype a string representation of the datatype
 * @return <code>true</code> if the datatype is an integer type
 *///  w  ww .j  av a2 s  .  co m
private static boolean isIntegerDatatype(String datatype) {
    return ArrayUtils.contains(integerDatatype, datatype);
}

From source file:br.msf.commons.netbeans.util.FileObjectUtils.java

public static Collection<FileObject> getFiles(final FileObject rootDir, final boolean recursive,
        final FileType... types) {
    assert rootDir != null && rootDir.isFolder() && !ArrayUtils.contains(types, FileType.OTHER);
    Collection<FileObject> fileObjects = new ArrayList<FileObject>();
    Enumeration<FileObject> entries = (Enumeration<FileObject>) rootDir.getChildren(recursive);
    while (entries.hasMoreElements()) {
        FileObject curr = entries.nextElement();
        if (curr.isData()) {
            FileType t = FileType.parse(curr.getExt());
            if (ArrayUtils.isEmpty(types) || ArrayUtils.contains(types, t)) {
                fileObjects.add(curr);/*from  w w w .  j a v a2 s . c om*/
            }
        }
    }
    return fileObjects;
}

From source file:com.pureinfo.srm.auth.action.UserAuthListAction.java

private int getStatus() {
    int status = 0;
    String temp = request.getParameter("status");
    if (temp != null && temp.matches("[0-9]+")) {
        status = Integer.parseInt(temp);
    }//from   w  w w. j  a  va2 s . c o m
    if (!ArrayUtils.contains(possibleStatus, status)) {
        return 0;
    }
    return status;
}

From source file:ips1ap101.lib.base.util.TemporalAddend.java

public boolean isValid() {
    return _quantity != 0 && ArrayUtils.contains(_validUnits, _unit);
}

From source file:com.elasticbox.jenkins.k8s.services.slavesprovisioning.chain.steps.SelectSuitablePodConfiguration.java

/**
 * Its mission is to create the Pod object that is going to be deployed as Jenkins slave.
 *//* w  ww.jav  a 2s.  c  o  m*/
@Override
public void handle(PodDeploymentContext deploymentContext) throws ServiceException {

    final Label jobLabel = deploymentContext.getJobLabel();

    if (jobLabel == null) {
        PodSlaveConfigurationParams podConfiguration = deploymentContext.getAvailablePodConfigurations().get(0);
        LOGGER.config("No label provided, returning first available pod configuration: " + podConfiguration);
        deploymentContext.setPodConfigurationChosen(podConfiguration);
        return;
    }

    for (PodSlaveConfigurationParams config : deploymentContext.getAvailablePodConfigurations()) {
        LOGGER.config("Looking for a slave configuration with label: " + jobLabel);

        final String[] labels = config.getLabels();
        if (ArrayUtils.contains(labels, jobLabel.getName())) {
            deploymentContext.setPodConfigurationChosen(config);
            return;
        }

    }

    //There is no pod configuration to handle this label
    LOGGER.config("There is no Pod slave configuration to handle this label: " + jobLabel.getName());
}

From source file:com.aionemu.gameserver.model.broker.filter.BrokerRecipeFilter.java

@Override
public boolean accept(ItemTemplate template) {
    ItemActions actions = template.getActions();
    if (actions != null) {
        CraftLearnAction craftAction = actions.getCraftLearnAction();
        if (craftAction != null) {
            int id = craftAction.getRecipeId();
            RecipeTemplate recipeTemplate = DataManager.RECIPE_DATA.getRecipeTemplateById(id);
            if (recipeTemplate != null && recipeTemplate.getSkillid() == craftSkillId) {
                return ArrayUtils.contains(masks, template.getTemplateId() / 100000);
            }/*from  www.j  ava2 s .c o  m*/
        }
    }
    return false;
}

From source file:com.htmlhifive.tools.codeassist.core.proposal.collector.InitializationHandlerCollector.java

@Override
protected boolean supportField(IObjectLiteralField field) {

    // // ww  w  . j ava 2  s  .c o m
    // 1.ISingleNameReference????
    // 2.?????????("__construct", "__init", "__ready")
    // 3.??????
    // 4.?null???????
    // 5.???????
    IExpression fieldName = field.getFieldName();
    if (!(fieldName instanceof ISingleNameReference)) {
        return false;
    }
    if (!ArrayUtils.contains(INITIAL_FIELD_NAMES,
            String.valueOf(((ISingleNameReference) fieldName).getToken()))) {
        return false;
    }
    if (!(field.getInitializer() instanceof IFunctionExpression)) {
        return false;
    }
    IFunctionDeclaration functionDec = ((IFunctionExpression) field.getInitializer()).getMethodDeclaration();
    return functionDec != null && functionDec.getArguments() != null && functionDec.getArguments().length > 0;
}

From source file:de.maklerpoint.office.Tags.Tags.java

/**
 * /*  w  w  w .ja v a2  s.  co m*/
 * @param tag
 * @param oldname 
 */
public static void updateTag(TagObj tag, String oldname) {
    Preferences prefs = Preferences.userRoot().node(Tags.class.getName());
    String taglist = prefs.get("tagListe", "Standard,ffentlich,Wichtig,Dienstlich,Persnlich");

    String[] result = taglist.split(",");

    if (result == null) {
        return;
    }

    boolean contains = ArrayUtils.contains(result, tag.getName());

    if (contains) {
        prefs.put("tag" + tag.getName(), tag.getTagColor() + "," + tag.getFontColor());
        InitializeTags.loadTags();
    } else {
        Tags.removeTag(oldname);
        addTag(tag);
    }
}

From source file:gda.device.scannable.StringPVConditionMonitor.java

private boolean beamOnTarget() {
    try {/*from w ww .  ja v  a  2s.c  o m*/
        String value = controller.cagetString(theChannel);
        return ArrayUtils.contains(okStrings, value);
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        return true;
    }
}

From source file:gda.device.detector.countertimer.TfgScalerWithLogValues.java

/**
 * When set to true ln(I0/It) and ln(I0/Iref) will be added to the output columns
 * //  ww  w . ja  v  a 2 s  .  com
 * @param outputLogValues
 *            The outputLogValues to set.
 */

public void setOutputLogValues(boolean outputLogValues) {
    this.outputLogValues = outputLogValues;

    // adjust the extraNmaes and outputFormat arrays
    if (!configured) {
        return;
    }
    if (outputLogValues) {
        if (!ArrayUtils.contains(extraNames, LNI0IT_LABEL)) {
            extraNames = (String[]) ArrayUtils.add(extraNames, LNI0IT_LABEL);
            outputFormat = (String[]) ArrayUtils.add(outputFormat, "%.5f");
        }
        if (!ArrayUtils.contains(extraNames, LNITIREF_LABEL)) {
            extraNames = (String[]) ArrayUtils.add(extraNames, LNITIREF_LABEL);
            outputFormat = (String[]) ArrayUtils.add(outputFormat, "%.5f");
        }
    } else {
        int numInputs = inputNames.length;
        if (ArrayUtils.contains(extraNames, LNI0IT_LABEL)) {
            int index = ArrayUtils.indexOf(extraNames, LNI0IT_LABEL);
            extraNames = (String[]) ArrayUtils.remove(extraNames, index);
            outputFormat = (String[]) ArrayUtils.remove(outputFormat, index + numInputs);
        }
        if (ArrayUtils.contains(extraNames, LNITIREF_LABEL)) {
            int index = ArrayUtils.indexOf(extraNames, LNITIREF_LABEL);
            extraNames = (String[]) ArrayUtils.remove(extraNames, index);
            outputFormat = (String[]) ArrayUtils.remove(outputFormat, index + numInputs);
        }

    }
}