Package java.util.regex

Examples of java.util.regex.Pattern.split()


    }

    static List<String> splitPath(String path, OperatingSystemFamily os) {
        Pattern s = os == WINDOWS ? WINDOWS_PATH_SPLITTER : UNIX_PATH_SPLITTER;
        List<String> l = new ArrayList<String>();
        for (String p : s.split(path)) {
            if (p.isEmpty()) continue;
            l.add(p);
        }
        return l;
    }
View Full Code Here


        Pattern pattern = patternCache.get(regex);
        if (pattern == null) {
            pattern = Pattern.compile(regex);
            patternCache.put(regex, pattern);
        }
        return  pattern.split(toSplit, 0);
    }

     public synchronized static String[] split(ServletContext sc,
             String toSplit, String regex) {
        Map<String, Pattern> patternCache = getPatternCache(sc);
View Full Code Here

        Pattern pattern = patternCache.get(regex);
        if (pattern == null) {
            pattern = Pattern.compile(regex);
            patternCache.put(regex, pattern);
        }
        return  pattern.split(toSplit, 0);
    }


    /**
     * <p>Returns the URL pattern of the
View Full Code Here

      boolean deprel = false;
      for (int j=0; j < orderFileLines.size(); j++) {
        deprel = false;
        featureText.setLength(0);
        splitfeats = "";
        items = tabPattern.split(orderFileLines.get(j));
        if (items.length < 2) {
          throw new FeatureException("The feature specification file '"+specModelURL.toString()+"' must contain at least two columns.");
        }
        if (!(columnNameMap.containsKey(ColumnNames.valueOf(items[0].trim())) || columnNameMap.containsValue(items[0].trim()))) {
          throw new FeatureException("Column one in the feature specification file '"+specModelURL.toString()+"' contains an unknown value '"+items[0].trim()+"'. ");
View Full Code Here

      final BufferedReader in = new BufferedReader(getGuide().getConfiguration().getConfigurationDir().getInputStreamReaderFromConfigFile(getModelName()+".dsm"));
      final Pattern tabPattern = Pattern.compile("\t");
      while(true) {
        String line = in.readLine();
        if(line == null) break;
        String[] cols = tabPattern.split(line);
        if (cols.length != 2) {
          throw new GuideException("");
        }
        int code = -1;
        int freq = 0;
View Full Code Here

        }
        int j = 0;
        try {
          problem.y[i] = Integer.parseInt(columns[j]);         
          for(j = 1; j < columns.length; j++) {
            final String[] items = pipePattern.split(columns[j]);
            for (int k = 0; k < items.length; k++) {
              try {
                int colon = items[k].indexOf(':');
                if (colon == -1) {
                  if (Integer.parseInt(items[k]) != -1) {
View Full Code Here

        try {
          problem.y[i] =
            Integer.parseInt(columns[j]);
          int p = 0;
          for(j = 1; j < columns.length; j++) {
            final String[] items = pipePattern.split(columns[j])
            for (int k = 0; k < items.length; k++) {
              try {
                if (Integer.parseInt(items[k]) != -1) {
                  xlist.add(p, new FeatureNode(Integer.parseInt(items[k])+offset, 1));
                  p++;
View Full Code Here

      BufferedReader br = new BufferedReader(isr);
      String line = null;
      Option option = null;
      Pattern tabPattern = Pattern.compile("\t");
      while ((line = br.readLine()) != null) {
        String[] items = tabPattern.split(line);
        if (items.length < 3 || items.length > 4) {
          throw new OptionException("Could not load the saved option. ");
        }
        option = optionDescriptions.getOption(items[1], items[2]);
        Object ovalue;
View Full Code Here

        if (fileLine.length() == 0 || fileLine.charAt(0) != '\t') {
          break;
        }
        String items[];
        try {
          items = tabPattern.split(fileLine.substring(1));
        } catch (PatternSyntaxException e) {
          throw new SymbolException("The header line of the symbol table  '"+fileLine.substring(1)+"' could not split into atomic parts. ", e);
        }
        if (items.length != 3) {
          throw new SymbolException("The header line of the symbol table  '"+fileLine.substring(1)+"' must contain four columns. ");
View Full Code Here

        int j = 0;
        try {
          prob.y[i] = (double)Integer.parseInt(columns[j]);
          int p = 0;
          for(j = 1; j < columns.length; j++) {
            final String[] items = pipePattern.split(columns[j])
            for (int k = 0; k < items.length; k++) {
              try {
                if (Integer.parseInt(items[k]) != -1) {
                  xlist.add(p, new svm_node());
                  xlist.get(p).value = 1;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.