Java String Tokenize getUnitType(String typeToken)

Here you can find the source of getUnitType(String typeToken)

Description

Returns the corresponding unit type constant for the given "type token" string.

License

Open Source License

Parameter

Parameter Description
typeToken the config definition token for the Gadgeteer input device type of interest

Declaration

public static Integer getUnitType(String typeToken) 

Method Source Code

//package com.java2s;
/*************** <auto-copyright.pl BEGIN do not edit this line> **************
 *
 * VR Juggler is (C) Copyright 1998-2011 by Iowa State University
 *
 * Original Authors:/*ww w  .j ava2s.  c  o m*/
 *   Allen Bierbaum, Christopher Just,
 *   Patrick Hartling, Kevin Meinert,
 *   Carolina Cruz-Neira, Albert Baker
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 *************** <auto-copyright.pl END do not edit this line> ***************/

import java.util.HashMap;
import java.util.Iterator;

import java.util.Map;

public class Main {
    private static Map mUnitTypeMap = new HashMap();

    /**
     * Returns the corresponding unit type constant for the given "type token"
     * string.  The type token must have been registered internally with this
     * class.  The collection of registered type tokens is the set of input
     * device types known to Gadgeteeer and defined as string constants in
     * <code>org.vrjuggler.vrjconfig.commoneditors.EditorConstants</code>.
     *
     * @param typeToken  the config definition token for the Gadgeteer input
     *                   device type of interest
     *
     * @see org.vrjuggler.vrjconfig.commoneditors.EditorConstants
     */
    public static Integer getUnitType(String typeToken) {
        for (Iterator i = mUnitTypeMap.keySet().iterator(); i.hasNext();) {
            String key = (String) i.next();
            if (typeToken.equals(key)) {
                return (Integer) mUnitTypeMap.get(key);
            }
        }

        throw new IllegalArgumentException("Type " + typeToken + " is not a known device type");
    }
}

Related

  1. getTokens(String string)
  2. getTokens(String string, String tokenSeparator)
  3. getTokens(String value)
  4. getTokens(String vbt)
  5. getTokenTypes(CommonTree tree)
  6. hasSuffix(String _token)
  7. isPOSTag(String token)
  8. isStringFunction(String token)
  9. isToken(String sentence, String searchWord)