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


Java StringTokenizer.nextElement方法代码示例

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


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

示例1: getNestedProperty

import java.util.StringTokenizer; //导入方法依赖的package包/类
public static Object getNestedProperty(Object bean, String nestedProperty)
		throws IllegalArgumentException, SecurityException, IllegalAccessException,
		InvocationTargetException, IntrospectionException, NoSuchMethodException {
	Object object = null;
	StringTokenizer st = new StringTokenizer(nestedProperty, ".", false);
	while (st.hasMoreElements() && bean != null) {
		String nam = (String) st.nextElement();
		if (st.hasMoreElements()) {
			bean = getProperty(bean, nam);
		}
		else {
			object = getProperty(bean, nam);
		}
	}
	return object;
}
 
开发者ID:dvbern,项目名称:doctemplate,代码行数:17,代码来源:PropertyUtils.java

示例2: recoverInline

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * Make sure we don't attempt to recover inline; if the parser successfully
 * recovers, it won't throw an exception.
 */
@Override
public Token recoverInline(Parser recognizer) throws RecognitionException {
    InputMismatchException e = new InputMismatchException(recognizer);

    String policies = recognizer.getInputStream().getText();
    StringTokenizer tk = new StringTokenizer(policies, ";");
    String policy = "";
    int idx = 0;
    while (tk.hasMoreElements()) {
        policy = (String) tk.nextElement();
        idx += policy.length();
        if (idx >= e.getOffendingToken().getStartIndex()) {
            break;
        }
    }

    String message = Messages.get(Messages.DEFAULT_LOCALE,
            "error_invalid_firewallconfig", new Object[] {
                    e.getOffendingToken().getText(), policy });
    throw new RuntimeException(message);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:26,代码来源:FWPolicyErrorStrategy.java

示例3: getNameStartsWithUpperCase

import java.util.StringTokenizer; //导入方法依赖的package包/类
public static String getNameStartsWithUpperCase( String sName, String sDelim ){
	
	String sNewName = new String();
	StringTokenizer tokenizer = new StringTokenizer( sName, sDelim );
	String str = "";
	boolean bFirstToken = true;
	while( tokenizer.hasMoreTokens() ){			
		if( bFirstToken ){
			bFirstToken = false;
			tokenizer.nextElement();
			continue;
		} 
		str = (String)tokenizer.nextElement();
		str = str.substring( 0, 1 ).toUpperCase() + str.substring( 1 );			
		sNewName += str;
	}
	return sNewName;
}
 
开发者ID:experdb,项目名称:eXperDB-DB2PG,代码行数:19,代码来源:StrUtil.java

示例4: namehash

import java.util.StringTokenizer; //导入方法依赖的package包/类
public byte[] namehash(String ethereumDomainName) {
    if (ethereumDomainName == null) {
        return null;
    }
    StringTokenizer tok = new StringTokenizer(".");
    int numElements = tok.countTokens() + 1;
    String[] labels = new String[numElements];
    for (int i=0; i < numElements; i++) {
        labels[i] = (String) tok.nextElement();
    }

    byte[] node = new byte[32];
    for (int i=labels.length; i >= 0; i--) {
        byte[] labelSha = Keccak.keccak256(labels[i].getBytes(UTF8));
        node = Keccak.keccak256(node, labelSha);
    }
    return node;
}
 
开发者ID:nelladragon,项目名称:scab,代码行数:19,代码来源:NameService.java

示例5: EmoticonesNeg

import java.util.StringTokenizer; //导入方法依赖的package包/类
public boolean EmoticonesNeg(String tweet) throws IOException{
    Charset charset = Charset.forName("Windows-1252");
    StringTokenizer st = new StringTokenizer(tweet, "\t ");
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    while (st.hasMoreElements()) {
            String token = (String) st.nextElement() ;
            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("ressources/emoticone.txt")));
            String ligne;	
            while ((ligne=br.readLine())!=null){
                    String [] tmp = ligne.split("\t");
                    if(token.indexOf(tmp[0]) != -1 && Double.parseDouble(tmp[1])<0){
                            br.close();
                            return true ;
                    }
            }
            br.close();
    }
    return false;
}
 
开发者ID:amineabdaoui,项目名称:french-sentiment-classification,代码行数:20,代码来源:CalculAttributs.java

示例6: ElongatedWords

import java.util.StringTokenizer; //导入方法依赖的package包/类
public int ElongatedWords(String tweet){
    StringTokenizer st = new StringTokenizer(tweet, " 	.,;:'\"|()?!-1234567890");
    String lastToken = null ;
    int cpt = 0, elw = 0 ; 
    char tmp = ' ';
    while (st.hasMoreElements()) {
        lastToken = (String) st.nextElement() ;
        int ltw = lastToken.length();
        tmp = ' ';
        cpt = 0 ;
        for(int i=0; i<ltw; i++){
            if( lastToken.charAt(i) == tmp ){
                    cpt++ ;
            }else 
                    cpt = 0 ;

            if( cpt >= 2 ){
                    elw++ ;
                    break ;
            }
            tmp = lastToken.charAt(i);
        }
    }
    return elw ;
}
 
开发者ID:amineabdaoui,项目名称:french-sentiment-classification,代码行数:26,代码来源:CalculAttributs.java

示例7: parseParameter

import java.util.StringTokenizer; //导入方法依赖的package包/类
public static boolean parseParameter(String parameter,Map parameters) {
  if(parameter == null)
    return false;
  if(parameter.equalsIgnoreCase("--v") || parameter.equalsIgnoreCase("--verbose")) {
    parameters.put("verbose",new Integer(1));
  }
  if(parameter.startsWith("--")) {
    try {
      StringTokenizer st = new StringTokenizer(parameter.substring(2),"=");
      String key = st.nextToken();
      String value = "";
      String sep = "";
      while(st.hasMoreTokens()) {
        value += sep + st.nextElement();
        sep = "=";
      }
      boolean valid = false;
      for(int i = 0 ; i < validKeys.length ;i++) {
        if(validKeys[i].equalsIgnoreCase(key)) {
          valid = true;
          break;
        }
      }
      if(!valid) {
        System.out.println("Invalid parameter : " + key);
        return false;
      }
      parameters.put(key,value);
      return true;
    } catch(Exception e) {
      System.out.println("Cannot parse " + parameter);
      return false;
    }
  }
  System.out.println("Cannot parse " + parameter);
  return false;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:38,代码来源:MakeTorrent.java

示例8: canUpdateElement

import java.util.StringTokenizer; //导入方法依赖的package包/类
private boolean canUpdateElement(String path) {
    StringTokenizer st = new StringTokenizer(path, "/");
    st.nextElement();
    long elementId = Long.parseLong(st.nextToken());
    long attributeId = Long.parseLong(st.nextToken());
    return accessor.canUpdateElement(elementId, attributeId);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:8,代码来源:IEngineImpl.java

示例9: processingInstruction

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * SAX2: Receive notification of a processing instruction.
 *       These require special handling for stylesheet PIs.
 */
public void processingInstruction(String name, String value) {
    // We only handle the <?xml-stylesheet ...?> PI
    if ((_target == null) && (name.equals("xml-stylesheet"))) {

        String href = null;    // URI of stylesheet found
        String media = null;   // Media of stylesheet found
        String title = null;   // Title of stylesheet found
        String charset = null; // Charset of stylesheet found

        // Get the attributes from the processing instruction
        StringTokenizer tokens = new StringTokenizer(value);
        while (tokens.hasMoreElements()) {
            String token = (String)tokens.nextElement();
            if (token.startsWith("href"))
                href = getTokenValue(token);
            else if (token.startsWith("media"))
                media = getTokenValue(token);
            else if (token.startsWith("title"))
                title = getTokenValue(token);
            else if (token.startsWith("charset"))
                charset = getTokenValue(token);
        }

        // Set the target to this PI's href if the parameters are
        // null or match the corresponding attributes of this PI.
        if ( ((_PImedia == null) || (_PImedia.equals(media))) &&
             ((_PItitle == null) || (_PImedia.equals(title))) &&
             ((_PIcharset == null) || (_PImedia.equals(charset))) ) {
            _target = href;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:Parser.java

示例10: fromString

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * Deserialize the string
 * 
 * @param values
 * @return
 */
public static String[] fromString(String values) {
	StringTokenizer st = new StringTokenizer(values, SEPARATOR);
	String[] ret = new String[st.countTokens()];
	int index = 0;
	while (st.hasMoreElements()) {
		String value = (String) st.nextElement();
		ret[index] = value;
		index++;
	}
	return ret;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:18,代码来源:SettingsManager.java

示例11: setExtensions

import java.util.StringTokenizer; //导入方法依赖的package包/类
public synchronized void setExtensions(String extensionString) {
    StringTokenizer extTokens = new StringTokenizer(extensionString, ",");
    int numExts = extTokens.countTokens();
    String extensionStrings[] = new String[numExts];

    for (int i = 0; i < numExts; i++) {
        String ext = (String)extTokens.nextElement();
        extensionStrings[i] = ext.trim();
    }

    fileExtensions = extensionStrings;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:MimeEntry.java

示例12: LastTokenPonctuation

import java.util.StringTokenizer; //导入方法依赖的package包/类
public boolean LastTokenPonctuation(String tweet){
    StringTokenizer st = new StringTokenizer(tweet, ".,|;:'\"()-\t ");
    String lastToken = "", sauv="";
    while (st.hasMoreElements()) {
            sauv=lastToken;
            lastToken = (String) st.nextElement();
    }
    if (lastToken.equals("lienHTTP")) lastToken=sauv;
    for(int i=0 ; i<lastToken.length() ; i++){
            if((lastToken.charAt(i) == '?') || (lastToken.charAt(i) == '!')){
                    return true ;
            }
    }
    return false; 
}
 
开发者ID:amineabdaoui,项目名称:french-sentiment-classification,代码行数:16,代码来源:CalculAttributs.java

示例13: QueryIdList

import java.util.StringTokenizer; //导入方法依赖的package包/类
public QueryIdList(String idList) {
        this();
        if(idList != null && idList.length()>0)
        {
            // 
            StringTokenizer st = new StringTokenizer(idList,",");
            while (st.hasMoreElements()) {
                String element = (String) st.nextElement();
                Integer i = new Integer(element);
                
                // In order to sort the list, work out where to put it,
                // either in the position of its value -1 (indexes start at 0)
                // or the last place in the list (list.size()-1)
                
                int position = 0;
                for (int loop = 0; loop < list.size(); loop ++)
                {
                    if(i.intValue() < ((Integer)list.get(loop)).intValue())
                    {
                        position = loop;
                        break;
                    }
                    else
                    {
                        position = loop + 1;
                    }
                }
                
//                if (list.size() > 0 && position == 0)
//                {
//                    position = list.size();
//                }
                list.add(position, i);
            }
        }
    }
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:37,代码来源:QueryIdList.java

示例14: getRecursiveProperty

import java.util.StringTokenizer; //导入方法依赖的package包/类
private Property getRecursiveProperty(String propertyPath, Iterator iter) throws MappingException {
	Property property = null;
	StringTokenizer st = new StringTokenizer( propertyPath, ".", false );
	try {
		while ( st.hasMoreElements() ) {
			final String element = ( String ) st.nextElement();
			if ( property == null ) {
				Property identifierProperty = getIdentifierProperty();
				if ( identifierProperty != null && identifierProperty.getName().equals( element ) ) {
					// we have a mapped identifier property and the root of
					// the incoming property path matched that identifier
					// property
					property = identifierProperty;
				}
				else if ( identifierProperty == null && getIdentifierMapper() != null ) {
					// we have an embedded composite identifier
					try {
						identifierProperty = getProperty( element, getIdentifierMapper().getPropertyIterator() );
						if ( identifierProperty != null ) {
							// the root of the incoming property path matched one
							// of the embedded composite identifier properties
							property = identifierProperty;
						}
					}
					catch( MappingException ignore ) {
						// ignore it...
					}
				}

				if ( property == null ) {
					property = getProperty( element, iter );
				}
			}
			else {
				//flat recursive algorithm
				property = ( ( Component ) property.getValue() ).getProperty( element );
			}
		}
	}
	catch ( MappingException e ) {
		throw new MappingException( "property [" + propertyPath + "] not found on entity [" + getEntityName() + "]" );
	}

	return property;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:PersistentClass.java

示例15: addBox

import java.util.StringTokenizer; //导入方法依赖的package包/类
private void addBox() {
    Function function = getFunction(box.reference);
    int i = box.name.indexOf('}');
    box.function = function;
    function.setName(box.name.substring(i + 1));
    StringTokenizer st = new StringTokenizer(box.name.substring(1, i), " ");
    if (st.hasMoreTokens())
        st.nextElement();
    if (st.hasMoreTokens()) {
        try {
            int font = Integer.parseInt(st.nextToken());
            function.setFont(uniqueFonts.get(font));
        } catch (Exception e) {
        }
    }
    if (st.hasMoreTokens())
        st.nextElement();

    Color bColor = null;
    Color fColor = null;

    if (st.hasMoreTokens()) {
        int tmp = Integer.parseInt(st.nextToken());
        if (tmp < COLORS.length) {
            fColor = COLORS[tmp];
        }
        tmp = Integer.parseInt(st.nextToken());
        if (tmp < COLORS.length) {
            bColor = COLORS[tmp];
        }
    }

    if (bColor != null)
        function.setBackground(bColor);
    if (fColor != null)
        function.setForeground(fColor);
    StringTokenizer tokenizer = new StringTokenizer(box.coordinates, " ()");
    FloatPoint p1 = toPoint(tokenizer.nextToken());
    FloatPoint p2 = toPoint(tokenizer.nextToken());
    FRectangle rectangle = new FRectangle(p1.getX(), p2.getY(), p2.getX()
            - p1.getX(), p1.getY() - p2.getY());
    function.setBounds(rectangle);
    Status status = new Status(Status.WORKING, "");

    function.setStatus(status);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:47,代码来源:IDLImporter.java


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