当前位置: 首页>>代码示例>>Java>>正文


Java StringTokenizer.hasMoreTokens方法代码示例

本文整理汇总了Java中java.util.StringTokenizer.hasMoreTokens方法的典型用法代码示例。如果您正苦于以下问题:Java StringTokenizer.hasMoreTokens方法的具体用法?Java StringTokenizer.hasMoreTokens怎么用?Java StringTokenizer.hasMoreTokens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.StringTokenizer的用法示例。


在下文中一共展示了StringTokenizer.hasMoreTokens方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkClassName

import java.util.StringTokenizer; //导入方法依赖的package包/类
private void checkClassName(String className) throws ClassNotFoundException {
    // Do stricter checking of class name validity on deferred
    //  because if the name is invalid, it will
    // never match a future loaded class, and we'll be silent
    // about it.
    StringTokenizer tokenizer = new StringTokenizer(className, ".");
    while (tokenizer.hasMoreTokens()) {
        String token = tokenizer.nextToken();
        // Each dot-separated piece must be a valid identifier
        // and the first token can also be "*". (Note that
        // numeric class ids are not permitted. They must
        // match a loaded class.)
        if (!isJavaIdentifier(token)) {
            throw new ClassNotFoundException();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:PatternReferenceTypeSpec.java

示例2: operate

import java.util.StringTokenizer; //导入方法依赖的package包/类
public Object operate( Object value )
{
    StringTokenizer st = new StringTokenizer( getString( value ),
        sep ) ;
    int length = st.countTokens() ;
    Object result = null ;
    int ctr = 0 ;
    while (st.hasMoreTokens()) {
        String next = st.nextToken() ;
        Object val = act.operate( next ) ;
        if (result == null)
            result = Array.newInstance( val.getClass(), length ) ;
        Array.set( result, ctr++, val ) ;
    }

    return result ;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:OperationFactory.java

示例3: refreshCache

import java.util.StringTokenizer; //导入方法依赖的package包/类
private void refreshCache(){
	if(this.classCache.size()==0){
		// No arguments, look in CLASSPATH
		String s = System.getProperties().getProperty("java.class.path");
		//  break apart with path sep.
		String pathSep = System.getProperties().getProperty("path.separator");
		StringTokenizer st = new StringTokenizer(s, pathSep);
		// Process each classpath
		while (st.hasMoreTokens()) {
			String cand = st.nextToken();
			if (cand.endsWith(".zip") || cand.endsWith(".jar")){
				processOneZip(cand);
			}else{ //assume directory
				File dir = new File(cand);
				if(dir.isDirectory()){
					processDirWithClassFiles(dir,dir);
				}
			}
		}
	}
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:22,代码来源:Reflection.java

示例4: _matchCompoundAccessibilityProperty

import java.util.StringTokenizer; //导入方法依赖的package包/类
private boolean _matchCompoundAccessibilityProperty(
  String               propertyName,
  AccessibilityProfile accProfile
  )
{
  StringTokenizer tokens = new StringTokenizer(propertyName, "&");

  while (tokens.hasMoreTokens())
  {
    // If any piece of the compound property fails to match, the
    // compound property fails to match
    if (!_matchAccessibilityProperty(tokens.nextToken(), accProfile))
      return false;
  }
  
  // Everything matched - the compound property matches.
  return true;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:19,代码来源:StyleSheetNode.java

示例5: shExpMatch

import java.util.StringTokenizer; //导入方法依赖的package包/类
public boolean shExpMatch(String str, String shexp) {
	StringTokenizer tokenizer = new StringTokenizer(shexp, "*");
	int startPos = 0;
	while (tokenizer.hasMoreTokens()) {
		String token = tokenizer.nextToken();
		// 07.05.2009 Incorrect? first token can be startsWith and last one
		// can be endsWith
		int temp = str.indexOf(token, startPos);
		if (temp == -1) {
			return false;
		} else {
			startPos = temp + token.length();
		}
	}
	return true;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:17,代码来源:PacScriptMethods.java

示例6: loadAdditionalPlugins

import java.util.StringTokenizer; //导入方法依赖的package包/类
public static void loadAdditionalPlugins(String pluginNames,
                                         List<GUIPlugin> plugins) {
    StringTokenizer st = new StringTokenizer(pluginNames, ", ");
    while (st.hasMoreTokens()) {
        String token = st.nextToken();
        try {
            Class<?> clazz = Class.forName(token);
            GUIPlugin plugin = (GUIPlugin) clazz.newInstance();
            plugins.add(plugin);
        } catch (Exception e) {
            System.out.println("Plugin " + token + " not found");
            // throw new RuntimeException(e);
        }
    }

}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:17,代码来源:GUIFramework.java

示例7: SourceMapper

import java.util.StringTokenizer; //导入方法依赖的package包/类
SourceMapper(String sourcepath) {
    /*
     * sourcepath can also arrive from the command line
     * as a String.  (via "-sourcepath")
     *
     * Using File.pathSeparator as delimiter below is OK
     * because we are on the same machine as the command
     * line originiated.
     */
    StringTokenizer st = new StringTokenizer(sourcepath,
                                             File.pathSeparator);
    List<String> dirList = new ArrayList<String>();
    while (st.hasMoreTokens()) {
        String s = st.nextToken();
        //XXX remove .jar and .zip files; we want only directories on
        //the source path. (Bug ID 4186582)
        if ( ! (s.endsWith(".jar") ||
                s.endsWith(".zip"))) {
            dirList.add(s);
        }
    }
    dirs = dirList.toArray(new String[0]);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:SourceMapper.java

示例8: checkIsDis

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * Return the DIS value from the systemId.
 *
 * @param systemId system Id.
 * @return return true if DIS else false
 */
public static boolean checkIsDis(String systemId) {
    StringTokenizer stringTokenizer = new StringTokenizer(systemId, "." + "-");
    int count = 0;
    while (stringTokenizer.hasMoreTokens()) {
        String str = stringTokenizer.nextToken();
        if (count == 3) {
            int x = Integer.parseInt(str);
            if (x > 0) {
                return true;
            }
        }
        count++;
    }
    return false;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:IsisTopologyProvider.java

示例9: fromList

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * Given a space-separated list of LDAP URLs, returns an array of strings.
 */
public static String[] fromList(String urlList) throws NamingException {

    String[] urls = new String[(urlList.length() + 1) / 2];
    int i = 0;              // next available index in urls
    StringTokenizer st = new StringTokenizer(urlList, " ");

    while (st.hasMoreTokens()) {
        urls[i++] = st.nextToken();
    }
    String[] trimmed = new String[i];
    System.arraycopy(urls, 0, trimmed, 0, i);
    return trimmed;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:LdapURL.java

示例10: parse

import java.util.StringTokenizer; //导入方法依赖的package包/类
void parse(String type, String attrs) {
    MimeEntry newEntry = new MimeEntry(type);

    // REMIND handle embedded ';' and '|' and literal '"'
    StringTokenizer tokenizer = new StringTokenizer(attrs, ";");
    while (tokenizer.hasMoreTokens()) {
        String pair = tokenizer.nextToken();
        parse(pair, newEntry);
    }

    add(newEntry);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:MimeTable.java

示例11: hasImport

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * Get the version of a package import from a bundle.
 * 
 * @param bundle
 * @param packageName
 * @return
 */
private static Version hasImport(Bundle bundle, String packageName) {
	Dictionary dict = bundle.getHeaders();
	// Check imports
	String imports = (String) dict.get(Constants.IMPORT_PACKAGE);
	Version v = getVersion(imports, packageName);
	if (v != null) {
		return v;
	}
	// Check for dynamic imports
	String dynimports = (String) dict.get(Constants.DYNAMICIMPORT_PACKAGE);
	if (dynimports != null) {
		for (StringTokenizer strok = new StringTokenizer(dynimports, COMMA); strok.hasMoreTokens();) {
			StringTokenizer parts = new StringTokenizer(strok.nextToken(), SEMI_COLON);
			String pkg = parts.nextToken().trim();
			if (pkg.endsWith(".*") && packageName.startsWith(pkg.substring(0, pkg.length() - 2)) || pkg.equals("*")) {
				Version version = Version.emptyVersion;
				for (; parts.hasMoreTokens();) {
					String modifier = parts.nextToken().trim();
					if (modifier.startsWith("version")) {
						version = Version.parseVersion(modifier.substring(modifier.indexOf(EQUALS) + 1).trim());
					}
				}
				return version;
			}
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:36,代码来源:DebugUtils.java

示例12: parseServerAddresses

import java.util.StringTokenizer; //导入方法依赖的package包/类
List<ServerAddress> parseServerAddresses(String hostlist) {
    List<ServerAddress> addresses = new ArrayList<>();
    StringTokenizer tokenizer = new StringTokenizer(hostlist, ",; ");
    while (tokenizer.hasMoreTokens()) {
        String host = tokenizer.nextToken();
        String[] split = host.split(":");
        int port = DEFAULT_PORT;
        if (split.length == 2) {
            port = Integer.parseInt(split[1]);
        }
        addresses.add(new ServerAddress(split[0], port));
    }
    return addresses;
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:15,代码来源:StandardMongoClientService.java

示例13: getPortAdminSpeed

import java.util.StringTokenizer; //导入方法依赖的package包/类
public PortSpeedValue.Admin getPortAdminSpeed(ConsoleAccess telnet,
                                              String ifName) throws IOException, AbortedException {
    StringTokenizer st = this.getResults(telnet, "show interface ethernet "
            + ifName);
    Matcher matcher, matcher2;

    while (st.hasMoreTokens()) {
        String newStr = st.nextToken();
        matcher = portTypePattern.matcher(newStr);
        matcher2 = portTypePattern2.matcher(newStr);
        if (matcher.matches()) {
            if (matcher.group(2).equals("Disabled")) {
                if (matcher.group(1).matches("10BASE.*")) {
                    return new PortSpeedValue.Admin(
                            10 * 1000 * 1000, "10M");
                }
                if (matcher.group(1).matches("100BASE.*")) {
                    return new PortSpeedValue.Admin(
                            100 * 1000 * 1000, "100M");
                }
                if (matcher.group(1).matches("1000BASE.*")) {
                    return new PortSpeedValue.Admin(
                            1000 * 1000 * 1000, "1000M");
                }
            } else if (matcher.group(2).equals("Enabled")) {
                return PortSpeedValue.Admin.AUTO;
            }
        }
        if (matcher2.matches()) {
            return PortSpeedValue.Admin.AUTO;
        }
    }
    throw new IOException("parse failed");
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:35,代码来源:SuperHubTelnetUtil.java

示例14: setBrandings

import java.util.StringTokenizer; //导入方法依赖的package包/类
/** Sets the list of brandings in multilanguage build */
public void setBrandings (String s) {
    if (s.startsWith("${")) return;
    StringTokenizer st = new StringTokenizer(s,", ");
    while (st.hasMoreTokens()) {
        brandings.add(st.nextToken());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:MakeListOfNBM.java

示例15: strictCompareExtensionVersion

import java.util.StringTokenizer; //导入方法依赖的package包/类
private int strictCompareExtensionVersion(String source, String target)
    throws NumberFormatException
{
    if (source.equals(target))
        return 0;

    StringTokenizer stk = new StringTokenizer(source, ".,");
    StringTokenizer ttk = new StringTokenizer(target, ".,");

    // Compare number
    int n = 0, m = 0, result = 0;

    // Convert token into meaning number for comparision
    if (stk.hasMoreTokens())
        n = convertToken(stk.nextToken().toString());

    // Convert token into meaning number for comparision
    if (ttk.hasMoreTokens())
        m = convertToken(ttk.nextToken().toString());

    if (n > m)
        return 1;
    else if (m > n)
        return -1;
    else
    {
        // Look for index of "." in the string
        int sIdx = source.indexOf(".");
        int tIdx = target.indexOf(".");

        if (sIdx == -1)
            sIdx = source.length() - 1;

        if (tIdx == -1)
            tIdx = target.length() - 1;

        return strictCompareExtensionVersion(source.substring(sIdx + 1),
                                             target.substring(tIdx + 1));
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:ExtensionInfo.java


注:本文中的java.util.StringTokenizer.hasMoreTokens方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。