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

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

Introduction

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

Prototype

public static int indexOf(boolean[] array, boolean valueToFind) 

Source Link

Document

Finds the index of the given value in the array.

Usage

From source file:org.openmrs.module.hospitalcore.util.ActionValue.java

public static String getIndentSubStoreName(int pos) {
    if (ArrayUtils.contains(INDENT_SUBSTORE, pos)) {
        return INDENT_SUBSTORE_NAMES[ArrayUtils.indexOf(INDENT_SUBSTORE, pos)];
    }/*from   ww  w. j ava 2s .  c  o m*/

    return " ";
}

From source file:org.openmrs.module.hospitalcore.util.ActionValue.java

public static String getIsDrugName(int pos) {
    if (ArrayUtils.contains(IS_DRUG, pos)) {
        return IS_DRUG_NAMES[ArrayUtils.indexOf(IS_DRUG, pos)];
    }//  w w  w .  jav  a 2 s.  c o m

    return " ";
}

From source file:org.openmrs.module.hospitalcore.util.ActionValue.java

public static String getIndentMainbStoreName(int pos) {
    if (ArrayUtils.contains(INDENT_MAINSTORE, pos)) {
        return INDENT_MAINSTORE_NAMES[ArrayUtils.indexOf(INDENT_MAINSTORE, pos)];
    }/*from   ww  w  . j  av  a2 s .c o m*/

    return " ";
}

From source file:org.openmrs.module.hospitalcore.util.ActionValue.java

public static String getDrugAttribute(int pos) {
    if (ArrayUtils.contains(DRUG_ATTRIBUTE, pos)) {
        return DRUG_ATTRIBUTE_NAMES[ArrayUtils.indexOf(DRUG_ATTRIBUTE, pos)];
    }//from   w ww . j a  v  a2  s .co m

    return " ";
}

From source file:org.openmrs.module.hospitalcore.util.ActionValue.java

public static String getItemAttribute(int pos) {
    if (ArrayUtils.contains(ITEM_ATTRIBUTE, pos)) {
        return ITEM_ATTRIBUTE_NAMES[ArrayUtils.indexOf(ITEM_ATTRIBUTE, pos)];
    }/*  w  w  w.j  ava2s .c  o  m*/

    return " ";
}

From source file:org.openmrs.module.hospitalcore.util.ActionValue.java

public static String getTransactionName(int pos) {
    if (ArrayUtils.contains(TRANSACTION, pos)) {
        return ActionValue.TRANSACTION_NAMES.get(ArrayUtils.indexOf(TRANSACTION, pos));
    }/*w  w w. j  av  a  2s .c  om*/

    return " ";
}

From source file:org.sipfoundry.sipxconfig.admin.dialplan.CallDigits.java

/**
 * Finds a first characted in the pattern string that is a special character and is not
 * escaped by escape character. Escape character is escaped by itself.
 *
 * @param pattern//w w w . j  ava2 s  .  c  om
 * @param special set of special characters to look for
 * @param escape
 * @return index of first non escaped special character, -1 if no such characters are in the
 *         string of if all of them are escaped
 */
static int findFirstNonEscapedSpecialChar(String pattern, String special, char escape) {
    char[] specialChars = special.toCharArray();
    boolean inEscape = false;
    for (int i = 0; i < pattern.length(); i++) {
        char c = pattern.charAt(i);
        if (c == escape) {
            inEscape = !inEscape;
            continue;
        }
        if (!inEscape && ArrayUtils.indexOf(specialChars, c) >= 0) {
            return i;
        }
        inEscape = false;
    }
    return -1;
}

From source file:org.sipfoundry.sipxconfig.bulk.ldap.SchemaTest.java

public void testGetObjectClassesNames() {
    Schema schema = new Schema();
    assertEquals(0, schema.getObjectClassesNames().length);
    schema.addClassDefinition("( 2.5.6.6 NAME 'bongo' DESC ''");
    schema.addClassDefinition("( 2.5.6.6 NAME 'kuku'");

    String[] classesNames = schema.getObjectClassesNames();

    assertEquals(2, classesNames.length);
    assertTrue(ArrayUtils.indexOf(classesNames, "bongo") >= 0);
    assertTrue(ArrayUtils.indexOf(classesNames, "kuku") >= 0);
}

From source file:org.sonar.api.resources.Scopes.java

public static boolean isHigherThan(final String scope, final String than) {
    int index = ArrayUtils.indexOf(SORTED_SCOPES, scope);
    int thanIndex = ArrayUtils.indexOf(SORTED_SCOPES, than);
    return index < thanIndex;
}

From source file:org.sonar.api.resources.Scopes.java

public static boolean isHigherThanOrEquals(final String scope, final String than) {
    int index = ArrayUtils.indexOf(SORTED_SCOPES, scope);
    int thanIndex = ArrayUtils.indexOf(SORTED_SCOPES, than);
    return index <= thanIndex;
}