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

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

Introduction

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

Prototype

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

Source Link

Document

Checks if the value is in the given array.

The method returns false if a null array is passed in.

Usage

From source file:cn.guoyukun.spring.utils.ImagesUtils.java

/**
 * ?//from   w  ww  .j a  v  a 2  s .  c o m
 *
 * @param filename
 * @return
 */
public static boolean isImage(String filename) {
    if (filename == null || filename.trim().length() == 0)
        return false;
    return ArrayUtils.contains(IMAGES_SUFFIXES, FilenameUtils.getExtension(filename).toLowerCase());
}

From source file:com.serotonin.m2m2.shared.ModuleUtils.java

public static boolean validateName(String name) {
    char[] allowedFirst = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
    char[] allowed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".toCharArray();

    if (!StringValidation.isLengthBetween(name, 3, 30)) {
        return false;
    }/*from  w  w w .  ja va2 s . c  o m*/
    if (!ArrayUtils.contains(allowedFirst, name.charAt(0))) {
        return false;
    }
    for (int i = 1; i < name.length(); i++) {
        if (!ArrayUtils.contains(allowed, name.charAt(i))) {
            return false;
        }
    }

    return !"core".equalsIgnoreCase(name);
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.AbstractAnnotatedEdmUtils.java

public static boolean isAbstractAnnotatedProperty(final String name) {
    return ArrayUtils.contains(PROPERTIES, name);
}

From source file:caveworld.core.ConfigHelper.java

public static boolean isMiningPointValidItem(ItemStack itemstack) {
    if (itemstack != null && itemstack.getItem() != null && itemstack.stackSize > 0) {
        String name = GameData.getItemRegistry().getNameForObject(itemstack.getItem());

        if (!itemstack.isItemStackDamageable()
                && (itemstack.getHasSubtypes() || itemstack.getItemDamage() > 0)) {
            name += ":" + itemstack.getItemDamage();
        }//  w  ww  .j a  v a 2s.c  o  m

        return Config.miningPointValidItems != null && ArrayUtils.contains(Config.miningPointValidItems, name);
    }

    return false;
}

From source file:de.ellpeck.actuallyadditions.mod.util.compat.IMCHandler.java

public static void doBlockIMC(Block block) {
    boolean allow = !ArrayUtils.contains(NO_CARRYING, block.getClass());
    FMLInterModComms.sendMessage("charset", (allow ? "add" : "remove") + "Carry", block.getRegistryName());
}

From source file:io.wcm.sling.commons.request.RequestPath.java

/**
 * Checks if the given selector is present in the current URL request (at any position).
 * @param request Sling request/*from w  ww.  j  ava  2  s  .  c o  m*/
 * @param expectedSelector Selector string to check for.
 * @return true if the selector was found
 */
public static boolean hasSelector(SlingHttpServletRequest request, String expectedSelector) {
    String[] selectors = request.getRequestPathInfo().getSelectors();
    return ArrayUtils.contains(selectors, expectedSelector);
}

From source file:com.l2jfree.gameserver.datatables.HeroSkillTable.java

public static boolean isHeroSkill(int skillId) {
    return ArrayUtils.contains(HERO_SKILL_IDS, skillId);
}

From source file:com.l2jfree.gameserver.datatables.NobleSkillTable.java

public static boolean isNobleSkill(int skillId) {
    return ArrayUtils.contains(NOBLE_SKILL_IDS, skillId);
}

From source file:catchla.yep.util.YepArrayUtils.java

public static boolean contains(final Object[] array, final Object[] values) {
    if (array == null || values == null)
        return false;
    for (final Object value : values) {
        if (!ArrayUtils.contains(array, value))
            return false;
    }/*from ww w. j av  a 2  s  .  c o m*/
    return true;
}

From source file:ivorius.ivtoolkit.blocks.Directions.java

@Nullable
public static Integer getHorizontalClockwiseRotations(ForgeDirection source, ForgeDirection dest,
        boolean mirrorX) {
    if (source == dest)
        return mirrorX && ArrayUtils.contains(Directions.X_AXIS, dest) ? 2 : 0;

    int arrayIndexSrc = ArrayUtils.indexOf(HORIZONTAL, source);
    int arrayIndexDst = ArrayUtils.indexOf(HORIZONTAL, dest);

    if (arrayIndexSrc >= 0 && arrayIndexDst >= 0) {
        int mirrorRotations = mirrorX && ArrayUtils.contains(Directions.X_AXIS, dest) ? 2 : 0;
        return ((arrayIndexSrc - arrayIndexDst + mirrorRotations) + HORIZONTAL.length) % HORIZONTAL.length;
    }/*  w ww .j  a v  a  2 s  . c o m*/

    return null;
}