Example usage for java.util StringTokenizer hasMoreElements

List of usage examples for java.util StringTokenizer hasMoreElements

Introduction

In this page you can find the example usage for java.util StringTokenizer hasMoreElements.

Prototype

public boolean hasMoreElements() 

Source Link

Document

Returns the same value as the hasMoreTokens method.

Usage

From source file:org.jbpm.formModeler.core.processing.fieldHandlers.SubformFieldHandler.java

public static boolean checkSubformDepthAllowed(Form form, String namesapce) {
    StringTokenizer token = new StringTokenizer(namesapce, FormProcessor.NAMESPACE_SEPARATOR, false);
    String _id = form.getId().toString();
    int count = 0;
    while (token.hasMoreElements()) {
        String idToCompare = (String) token.nextElement();
        if (idToCompare.equals(_id)) {
            count++;/*from ww w.  java 2 s . c  o m*/
            if (count >= maxDepth) {
                return false;
            }
        }

    }
    return true;

}

From source file:tvbrowser.core.search.booleansearch.BooleanSearcher.java

private static Vector<Object> subPart(StringTokenizer tokenizer) throws ParserException {
    Vector<Object> v = new Vector<Object>();
    while (tokenizer.hasMoreElements()) {
        String s = tokenizer.nextToken();
        if (s.equals("(")) {
            v.add(subPart(tokenizer));/*from w  w w  .  j  a va  2s . co m*/
        } else {
            if (s.equals(")")) {
                return v;
            } else {
                v.add(s);
            }
        }
    }
    throw new ParserException(mLocalizer.msg("parenthesisExpected", "'(' expected"));
}

From source file:org.jboss.tools.livereload.internal.io.LiveReloadScriptInjectionFilter.java

/**
 * <p>//from  w  ww . ja  va2  s .co m
 * Iterates over the given acceptedContentTypes, looking for one of those
 * values:
 * <ul>
 * <li>text/html</li>
 * <li>application/xhtml+xml</li>
 * <li>application/xml</li>
 * </ul>
 * </p>
 * 
 * @param acceptedContentTypes
 * @return true if one of the values above was found, false otherwise
 */
private static boolean isHtmlContentType(final String acceptedContentTypes) {
    if (acceptedContentTypes == null) {
        return false;
    }
    final StringTokenizer tokenizer = new StringTokenizer(acceptedContentTypes, ",");
    while (tokenizer.hasMoreElements()) {
        final String acceptedContentType = tokenizer.nextToken();
        if ("text/html".equals(acceptedContentType) || "application/xhtml+xml".equals(acceptedContentType)
                || "application/xml".equals(acceptedContentType)) {
            return true;
        }
    }
    return false;
}

From source file:org.kie.workbench.common.services.backend.compiler.impl.classloader.CompilerClassloaderUtils.java

public static List<String> readItemsFromClasspathString(Set<String> depsModules) {

    Set<String> items = new HashSet<>();
    Iterator<String> iter = depsModules.iterator();
    while (iter.hasNext()) {
        StringTokenizer token = new StringTokenizer(iter.next());
        while (token.hasMoreElements()) {
            String item = token.nextToken(":");
            if (item.endsWith(CommonConstants.JAVA_ARCHIVE_RESOURCE_EXT)) {
                StringBuilder sb = new StringBuilder(CommonConstants.FILE).append(item);
                items.add(sb.toString());
            }/*from   w ww  . ja  va 2  s . c  o  m*/
        }
    }
    return new ArrayList<>(items);
}

From source file:org.squale.welcom.outils.Access.java

/**
 * Parse le token || pour la mise en place du ou
 * //from   w  w w  . jav  a2  s.  c o m
 * @param logonbean : Le bien de logon pour la verifieation de la clef
 * @param accessKey : Valeur a tester
 * @return Vrai si OK
 */
public static String getMultipleSecurityPage(final WILogonBeanSecurity logonbean, final String accessKey) {

    if (logonbean == null) {
        return READWRITE;
    }

    final StringTokenizer droitSplitter = new StringTokenizer(accessKey, "||");
    String access = NONE;

    while (droitSplitter.hasMoreElements()) {
        final String item = (String) droitSplitter.nextElement();

        final String acc = logonbean.getAccess(item);

        if (((checkAccessDroit(access, NONE) || checkAccessDroit(access, NO)) && checkAccessDroit(acc))
                || (checkAccessDroit(access, READONLY) && checkAccessDroit(acc, READWRITE))) {
            access = acc;
        }
    }

    return access;
}

From source file:org.openmrs.module.report.util.StringUtils.java

/**
 * /*from   w ww.j a v  a2s.com*/
    * <p> Method: replaceSpecialCharacter() </p>
    * <p> Objective: replaceSpecialCharacter's objective </p>
    * <p> Params:  </p> 
    * <p> Return: String </p>
    * <p> Author: Nguyen manh chuyen </p>
    * <p> Update by: Nguyen manh chuyen </p>
    * <p> Version: $1.0 </p>
    * <p> Create date: Jan 13, 2009 10:53:41 AM </p>
    * <p> Update date: Jan 13, 2009 10:53:41 AM </p>
*
 */
public static String replaceSpecialCharacter(String sInput) {
    StringTokenizer tokenizer = new StringTokenizer(sInput, TOKENS);
    String temp = "";
    if (tokenizer.hasMoreElements()) {
        while (tokenizer.hasMoreElements()) {
            temp += tokenizer.nextToken();
        }

    }
    return temp;
}

From source file:org.openmrs.module.report.util.StringUtils.java

public static String replaceSpecialWithWhiteSpaceCharacter(String sInput) {
    StringTokenizer tokenizer = new StringTokenizer(sInput, TOKENS);
    String temp = "";
    if (tokenizer.hasMoreElements()) {
        while (tokenizer.hasMoreElements()) {
            temp += tokenizer.nextToken();
            temp += "-";
        }/*  ww w .j  a v  a2 s. c om*/

        temp = temp.substring(0, temp.length() - 1);
    }
    return temp;
}

From source file:org.openmrs.module.report.util.StringUtils.java

public static String replaceSpecialWithUnderLineCharacter(String sInput) {

    StringTokenizer tokenizer = new StringTokenizer(sInput, TOKENS);
    String temp = "";
    if (tokenizer.hasMoreElements()) {
        while (tokenizer.hasMoreElements()) {
            temp += tokenizer.nextToken();
            temp += "_";
        }//from  w w  w. ja va 2s.  c o m

        temp = temp.substring(0, temp.length() - 1);
    }
    return temp;
}

From source file:org.openmrs.module.report.util.StringUtils.java

public static Vector<String> splitCharacterExt(String sInput) {
    StringTokenizer tokenizer = new StringTokenizer(sInput, "/");
    Vector<String> vector = null;
    if (tokenizer.hasMoreElements()) {
        vector = new Vector<String>();
        while (tokenizer.hasMoreElements()) {
            vector.add(tokenizer.nextToken());
        }//from   w w w .  ja  v  a2 s . co  m
    }
    return vector;
}

From source file:org.openmrs.module.report.util.StringUtils.java

/**
 * //from   ww w  .j  a  v  a2 s  . com
    * <p> Method: splitCharacter() </p>
    * <p> Objective: splitCharacter's objective </p>
    * <p> Params:  </p> 
    * <p> Return: Vector<String> </p>
    * <p> Author: Nguyen manh chuyen </p>
    * <p> Update by: Nguyen manh chuyen </p>
    * <p> Version: $1.0 </p>
    * <p> Create date: Jan 13, 2009 4:15:00 PM </p>
    * <p> Update date: Jan 13, 2009 4:15:00 PM </p>
*
 */
public static Vector<String> splitCharacter(String sInput) {
    StringTokenizer tokenizer = new StringTokenizer(sInput, TOKENS);
    Vector<String> vector = null;
    if (tokenizer.hasMoreElements()) {
        vector = new Vector<String>();
        while (tokenizer.hasMoreElements()) {
            vector.add(tokenizer.nextToken());
        }
    }
    return vector;
}