List of usage examples for org.apache.commons.lang ArrayUtils contains
public static boolean contains(boolean[] array, boolean valueToFind)
Checks if the value is in the given array.
From source file:com.codebutler.farebot.card.Card.java
public static Card dumpTag(byte[] tagId, Tag tag) throws Exception { final String[] techs = tag.getTechList(); if (ArrayUtils.contains(techs, "android.nfc.tech.NfcB")) return CEPASCard.dumpTag(tag); else if (ArrayUtils.contains(techs, "android.nfc.tech.IsoDep")) return DesfireCard.dumpTag(tag); else if (ArrayUtils.contains(techs, "android.nfc.tech.NfcF")) return FelicaCard.dumpTag(tagId, tag); else if (ArrayUtils.contains(techs, "android.nfc.tech.MifareClassic")) return ClassicCard.dumpTag(tagId, tag); else/* w w w.j a v a 2s . c om*/ throw new UnsupportedTagException(techs, Utils.getHexString(tag.getId())); }
From source file:com.dp2345.service.impl.CaptchaServiceImpl.java
public boolean isValid(CaptchaType captchaType, String captchaId, String captcha) { Setting setting = SettingUtils.get(); if (captchaType == null || ArrayUtils.contains(setting.getCaptchaTypes(), captchaType)) { if (StringUtils.isNotEmpty(captchaId) && StringUtils.isNotEmpty(captcha)) { try { return imageCaptchaService.validateResponseForID(captchaId, captcha.toUpperCase()); } catch (Exception e) { return false; }/*from ww w . j a v a 2s . c o m*/ } else { return false; } } else { return true; } }
From source file:com.aionemu.gameserver.model.broker.filter.BrokerContainsFilter.java
@Override public boolean accept(ItemTemplate template) { return ArrayUtils.contains(masks, template.getTemplateId() / 100000); }
From source file:com.iterzp.momo.service.impl.CaptchaServiceImpl.java
@Override public boolean isValid(CaptchaType captchaType, String captchaId, String captcha) { Setting setting = SettingUtils.get(); if (captchaType == null || ArrayUtils.contains(setting.getCaptchaTypes(), captchaType)) { if (StringUtils.isNotEmpty(captchaId) && StringUtils.isNotEmpty(captcha)) { try { return imageCaptchaService.validateResponseForID(captchaId, captcha.toUpperCase()); } catch (Exception e) { return false; }//from w w w. j a va2 s . c om } else { return false; } } else { return true; } }
From source file:com.aionemu.gameserver.model.broker.filter.BrokerContainsExtraFilter.java
@Override public boolean accept(ItemTemplate template) { return ArrayUtils.contains(masks, template.getTemplateId() / 10000); }
From source file:com.hs.mail.imap.dao.FlagUtils.java
@SuppressWarnings("unchecked") static String buildParams(Flags.Flag[] flags, boolean replace, boolean set, List params) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < flagArray.length; i++) { boolean contains = ArrayUtils.contains(flags, flagArray[i]); if (contains || replace) { sb.append(attrArray[i]).append("= ?,"); params.add(replace ? (contains ? "Y" : "N") : (set ? "Y" : "N")); }/*from www . j a va2s.c o m*/ } return StringUtils.stripEnd(sb.toString(), ","); }
From source file:com.tibbo.linkserver.plugin.device.file.item.NumericItem.java
private void validate() { super.validate(getItemRegisterCount()); if (range == 0 || range == 1) { throw new IllegalStateException("Only binary values can be read from Coil and Input ranges"); }/* w w w. j av a 2 s . co m*/ if (!ArrayUtils.contains(DATA_TYPES, dataType)) { throw new IllegalStateException("Invalid data type"); } else { return; } }
From source file:de.unistuttgart.ims.uimautil.AnnotationUtil.java
/** * trims the annotated text. Similar to {@link String#trim()}, this method * moves the begin and end indexes towards the middle as long as there is * whitespace.//from w w w . j a v a 2s .co m * * The method throws a ArrayIndexOutOfBoundsException if the entire * annotation consists of whitespace. * * @param annotation * The annotation to trim * @param ws * An array of chars that are to be considered whitespace * @param <T> * The annotation type * @return The trimmed annotation (not a copy) * @since 0.4.1 */ public static <T extends Annotation> T trim(T annotation, char... ws) { final char[] s = annotation.getCoveredText().toCharArray(); if (s.length == 0) return annotation; int b = 0; while (ArrayUtils.contains(ws, s[b])) { b++; } int e = 0; while (ArrayUtils.contains(ws, s[(s.length - 1) - e])) { e++; } annotation.setBegin(annotation.getBegin() + b); annotation.setEnd(annotation.getEnd() - e); return annotation; }
From source file:ips1ap101.lib.base.util.TemporalAddend.java
public TemporalAddend(String string) { init();//from ww w . ja va 2 s. c om String trimmed = StringUtils.trimToNull(string); if (trimmed != null) { int end = trimmed.length() - 1; char unit = trimmed.charAt(end); boolean digit = Character.isDigit(unit); _quantity = digit ? quantityOf(trimmed) : quantityOf(trimmed.substring(0, end)); _unit = ArrayUtils.contains(_validUnits, unit) ? unit : digit ? 'D' : '?'; } }
From source file:gr.abiss.calipso.fs.FilePersistenceService.java
public static boolean isImage(String contentType) { return ArrayUtils.contains(MIMES_IMAGE, contentType.toLowerCase()); }