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


Java StringTokenizer.hasMoreElements方法代码示例

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


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

示例1: stringToBounds

import java.util.StringTokenizer; //导入方法依赖的package包/类
static Rectangle stringToBounds(final String  bounds) throws NumberFormatException {
    StringTokenizer st = new StringTokenizer(bounds, " ,"); // NOI18N
    int x, y, width, height;
    x = y = width = height =0;
    for (int i = 0; i < 4; i++) {
        if (!st.hasMoreElements()) {
            throw new NumberFormatException();
        }
        switch (i) {
            case 0:
                x = Integer.parseInt(st.nextToken());
                break;
            case 1:
                y = Integer.parseInt(st.nextToken());
                break;
            case 2:
                width = Integer.parseInt(st.nextToken());
                break;
            case 3:
                height = Integer.parseInt(st.nextToken());
                break;
                
        }
    }
    return new Rectangle(x,y,width,height);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:SplashUISupport.java

示例2: stringToKeys

import java.util.StringTokenizer; //导入方法依赖的package包/类
/** Convert a space-separated list of user-friendly key binding names to a list of Swing key strokes.
* @param s the string with keys
* @return array of key strokes, or <code>null</code> if the string description is not valid
* @see #stringToKey
*/
public static KeyStroke[] stringToKeys(String s) {
    StringTokenizer st = new StringTokenizer(s.toUpperCase(Locale.ENGLISH), " "); // NOI18N
    ArrayList<KeyStroke> arr = new ArrayList<KeyStroke>();

    while (st.hasMoreElements()) {
        s = st.nextToken();

        KeyStroke k = stringToKey(s);

        if (k == null) {
            return null;
        }

        arr.add(k);
    }

    return arr.toArray(new KeyStroke[arr.size()]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:Utilities.java

示例3: updateOuners

import java.util.StringTokenizer; //导入方法依赖的package包/类
public void updateOuners() {
    List<Qualifier> cls = dataPlugin.getEngine().getQualifiers();
    for (int i = cls.size() - 1; i >= 0; i--) {
        if (IDEF0Plugin.isFunction(cls.get(i)))
            cls.remove(i);
    }
    Collections.sort(cls, new Comparator<Qualifier>() {

        Collator collator = Collator.getInstance();

        @Override
        public int compare(Qualifier o1, Qualifier o2) {
            return collator.compare(o1.getName(), o2.getName());
        }
    });
    cls.remove(dataPlugin.getBaseFunction());
    clasificators = cls.toArray(new Qualifier[cls.size()]);
    String s = dataPlugin.getProperty(DataPlugin.PROPERTY_OUNERS);
    if (s == null)
        s = "";
    final StringTokenizer st = new StringTokenizer(s, " ");
    while (st.hasMoreElements()) {
        owners.add(Long.parseLong(st.nextToken()));
    }
    model.fireTableDataChanged();
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:27,代码来源:OwnerClasificators.java

示例4: extractPathSessionId

import java.util.StringTokenizer; //导入方法依赖的package包/类
protected String extractPathSessionId(String url) {
    String sessionId = null;
    int iStart = url.indexOf(SESSION_PARAMETER_START);
    if (iStart > -1) {
        iStart += SESSION_PARAMETER_START.length();
        String remainder = url.substring(iStart);
        StringTokenizer parser = new StringTokenizer(remainder,
                SESSION_PATH_PARAMETER_TAILS);
        if (parser.hasMoreElements()) {
            sessionId = parser.nextToken();
        }
        else {
            sessionId = url.substring(iStart);
        }
    }
    return sessionId;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:TestFormAuthenticator.java

示例5: setTagsAsString

import java.util.StringTokenizer; //导入方法依赖的package包/类
public void setTagsAsString(String tags) {
    // Convert comma separated list into list
    StringTokenizer tok = new StringTokenizer(tags, ",");
    List<String> list = new ArrayList<String>();
    while (tok.hasMoreElements()) {
        String tagValue = tok.nextElement().toString().trim();
        if (tagValue.length() > 0)
            list.add(tagValue.trim());
    }
    vo.setTags(list);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:12,代码来源:TechnicalService.java

示例6: getRules

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * De-tokenize the elements listed in the 'elements' attribute and
 * instanciate a set of strip/preserve rules.
 */
public Vector getRules() {
    final Vector rules = new Vector();
    // Go through each element and instanciate strip/preserve-object
    final StringTokenizer list = new StringTokenizer(_elementList);
    while (list.hasMoreElements()) {
        rules.add(new WhitespaceRule(_action,
                                     list.nextToken(),
                                     _importPrecedence));
    }
    return rules;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:Whitespace.java

示例7: createBlocksFromLines

import java.util.StringTokenizer; //导入方法依赖的package包/类
public void createBlocksFromLines() {

        final JTextArea textArea = new JTextArea();

        BaseDialog dialog = new BaseDialog(getPanel().getFramework()
                .getMainFrame()) {
            @Override
            protected void onOk() {
                if (textArea.getText().trim().length() > 0) {
                    StringTokenizer st = new StringTokenizer(
                            textArea.getText(), "\n");
                    List<String> strings = new ArrayList<String>();

                    while (st.hasMoreElements()) {
                        String s = st.nextToken().trim();
                        if (s.length() > 0)
                            strings.add(s);
                    }
                    startUserTransaction();
                    createBlocks(strings.toArray(new String[strings.size()]));
                    commitUserTransaction();
                    super.onOk();
                }
            }
        };

        dialog.setMainPane(new JScrollPane(textArea));

        ResourceLoader.setJComponentsText(dialog);

        dialog.setBounds(0, 0, 800, 600);
        dialog.setLocationRelativeTo(null);

        dialog.setVisible(true);
    }
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:36,代码来源:MovingArea.java

示例8: parseRows

import java.util.StringTokenizer; //导入方法依赖的package包/类
private int[] parseRows(String s) {
    String rowText = "";
    int i = s.indexOf("rows:");
    if (i != -1) {
        int j = s.indexOf("columns:");
        if (j == -1) {
            rowText = s.substring(i + 5);
        } else {
            rowText = s.substring(i + 5, j);
        }
        int k = rowText.indexOf('[');
        int l = rowText.indexOf(']');
        rowText = rowText.substring(k + 1, l);
    }
    StringTokenizer tokenizer = new StringTokenizer(rowText, ", ");
    List<String> rows = new ArrayList<String>();
    while (tokenizer.hasMoreElements()) {
        rows.add(tokenizer.nextToken());
    }
    int irows[] = new int[rows.size()];
    for (int j = 0; j < irows.length; j++) {
        try {
            irows[j] = Integer.parseInt(rows.get(j));
        } catch (Throwable t) {
            return new int[0];
        }
    }
    return irows;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:30,代码来源:JTableJavaElement.java

示例9: buildSchemaLocationMap

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * Build schema location map of schemas used in given <code>schemaLocationAttribute</code> and
 * adds them to the given <code>schemaLocationMap</code>.
 * 
 * @see <a href="http://www.w3.org/TR/xmlschema-0/#schemaLocation">XML Schema Part 0: Primer
 *      Second Edition | 5.6 schemaLocation</a>
 * 
 * @param schemaLocationMap {@link Map} to add schema locations to.
 * @param schemaLocation attribute value to build schema location map from.
 * @return {@link Map} of schema namespace URIs to location URLs.
 * @since GemFire 8.1
 */
static final Map<String, List<String>> buildSchemaLocationMap(
    Map<String, List<String>> schemaLocationMap, final String schemaLocation) {
  if (null == schemaLocation) {
    return schemaLocationMap;
  }

  if (null == schemaLocation || schemaLocation.isEmpty()) {
    // should really ever be null but being safe.
    return schemaLocationMap;
  }

  final StringTokenizer st = new StringTokenizer(schemaLocation, " \n\t\r");
  while (st.hasMoreElements()) {
    final String ns = st.nextToken();
    final String loc = st.nextToken();
    List<String> locs = schemaLocationMap.get(ns);
    if (null == locs) {
      locs = new ArrayList<>();
      schemaLocationMap.put(ns, locs);
    }
    if (!locs.contains(loc)) {
      locs.add(loc);
    }
  }

  return schemaLocationMap;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:40,代码来源:XmlUtils.java

示例10: jButton2ActionPerformed

import java.util.StringTokenizer; //导入方法依赖的package包/类
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
        jLabel1.setText(jComboBox1.getSelectedItem().toString());
        
        String satir = "[0]|1|[2]|4|3";
        StringTokenizer st = new StringTokenizer(satir, "|");
        
        while (st.hasMoreElements()) {
            String mytoken1 = st.nextElement().toString();
            if(!(mytoken1.contains("[") || mytoken1.contains("]")))
            {
                 System.out.println(mytoken1);
            }
           
            
//            StringTokenizer st2 = new StringTokenizer(mytoken1, " ");
//            while (st2.hasMoreElements()) {
//                String mytoken2 = st2.nextElement().toString();
//               // System.out.println(mytoken2);
//                mytoken2 = mytoken2.replace("[", "").replace("]", "");
//                System.out.println(mytoken2);
//            }
        }

		

        
    }
 
开发者ID:sametkaya,项目名称:Java_Swing_Programming,代码行数:29,代码来源:Soru_1.java

示例11: ComputePosPolarimots

import java.util.StringTokenizer; //导入方法依赖的package包/类
public int ComputePosPolarimots(String tweet) throws FileNotFoundException, IOException, TreeTaggerException{
    int count=0;
    String lemme;
    StringTokenizer st = new StringTokenizer(tweet, " 	.,;:'\"|()?!-_/<>‘’“”…«»•&#{[|`^@]}$*%1234567890", false);
    while (st.hasMoreElements()){
        lemme=st.nextToken();
        if(lemme.contains("|")) lemme=lemme.split("|")[0];
        if (alPosPolarimots.contains(lemme)) count++;
    }
    return count;
}
 
开发者ID:amineabdaoui,项目名称:french-sentiment-classification,代码行数:12,代码来源:CalculAttributs.java

示例12: Negate

import java.util.StringTokenizer; //导入方法依赖的package包/类
public static String Negate(String tweet) throws FileNotFoundException, IOException{
    boolean Sepa=false, Nega=false;
    String s, tok;
    ArrayList<String> Neg = new ArrayList<>();
    
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    //BufferedReader r = new BufferedReader(new InputStreamReader(classLoader.getResourceAsStream("Negations.txt")));
    BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream("ressources//Negations.txt")));
    
    while ((s=r.readLine())!=null) Neg.add(s);
    r.close();
    StringTokenizer st = new StringTokenizer(tweet, " \n         .,;:'‘’\"?[]!-_\\/“<>$&®´…«»1234567890", true);
    boolean start=false, end=false;
    s="";
    while (st.hasMoreElements()){
        Nega=false;
        Sepa=false;
        tok=st.nextElement().toString();
        if (s.length()>=1 && !s.endsWith(" ")) s+=" ";
        for (String n:Neg) if (tok.equals(n)){
            start=true;
            Nega=true;
        }
        if (tok.equals(".") || tok.equals(",") || tok.equals(";") || tok.equals("?") || tok.equals("!") || tok.equals(":") || tok.equals("(") || tok.equals(")")){
            end=true;
            Sepa=true;
        }
        for (String se:sep) if(se.equals(tok)) Sepa=true;
        if (!Sepa) {
            s+=tok;
            if (start && !end && !Nega) s+="_neg";
        }
    }
    return s;
}
 
开发者ID:amineabdaoui,项目名称:french-sentiment-classification,代码行数:36,代码来源:Pretraitements.java

示例13: registerTestLibraryTypeProvider

import java.util.StringTokenizer; //导入方法依赖的package包/类
private static void registerTestLibraryTypeProvider () throws Exception {
    StringTokenizer tk = new StringTokenizer("org-netbeans-api-project-libraries/LibraryTypeProviders","/");
    FileObject root = FileUtil.getConfigRoot();
    while (tk.hasMoreElements()) {
        String pathElement = tk.nextToken();
        FileObject tmp = root.getFileObject(pathElement);
        if (tmp == null) {
            tmp = root.createFolder(pathElement);
        }
        root = tmp;
    }
    if (root.getChildren().length == 0) {
        InstanceDataObject.create (DataFolder.findFolder(root),"TestLibraryTypeProvider",TestLibraryTypeProvider.class);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ProjectLibraryProviderTest.java

示例14: toIntegerList

import java.util.StringTokenizer; //导入方法依赖的package包/类
public static List<Integer> toIntegerList(String str, String regex) {
	StringTokenizer t = new StringTokenizer(str, regex);
	List<Integer> l = new ArrayList<Integer>();
	while (t.hasMoreElements()) {
		String s = t.nextToken();
		if (isNotBlank(s)) {
			l.add(Integer.parseInt(s));
		}
	}
	return l;
}
 
开发者ID:onsoul,项目名称:os,代码行数:12,代码来源:LNUtils.java

示例15: addJarsToSkip

import java.util.StringTokenizer; //导入方法依赖的package包/类
private static void addJarsToSkip(String systemPropertyName) {
    String jarList = System.getProperty(systemPropertyName);
    if (jarList != null) {
        StringTokenizer tokenizer = new StringTokenizer(jarList, ",");
        while (tokenizer.hasMoreElements()) {
            String token = tokenizer.nextToken().trim();
            if (token.length() > 0) {
                pluggabilityJarsToSkip.add(token);
            }
        }
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:ContextConfig.java


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