Parse response string to ClusterConfiguration instance.

@param line
@return
766608
public static ClusterConfigration parseConfiguration(String line) {
    String[] lines = line.trim().split("(?:\\r?\\n)");
    if (lines.length < 2) {
      throw new IllegalArgumentException("Incorrect config response:" + line);
    }
    String configversion = lines[0];
    String nodeListStr = lines[1];
    if (!ByteUtils.isNumber(configversion)) {
      throw new IllegalArgumentException(
          "Invalid configversion: " + configversion + ", it should be a number.");
    }
    String[] nodeStrs = nodeListStr.split("(?:\\s)+");
    int version = Integer.parseInt(configversion);
    List<CacheNode> nodeList = new ArrayList<CacheNode>(nodeStrs.length);
    for (String nodeStr : nodeStrs) {
      if (nodeStr.equals("")) {
        continue;
      }

      int firstDelimiter = nodeStr.indexOf(DELIMITER);
      int secondDelimiter = nodeStr.lastIndexOf(DELIMITER);
      if (firstDelimiter < 1 || firstDelimiter == secondDelimiter) {
        throw new IllegalArgumentException(
            "Invalid server ''" + nodeStr + "'' in response:  " + line);
      }
      String hostName = nodeStr.substring(0, firstDelimiter).trim();
      String ipAddress = nodeStr.substring(firstDelimiter + 1, secondDelimiter).trim();
      String portNum = nodeStr.substring(secondDelimiter + 1).trim();
      int port = Integer.parseInt(portNum);
      nodeList.add(new CacheNode(hostName, ipAddress, port));
    }

    return new ClusterConfigration(version, nodeList);

  }
1122203
public String getHashForLine(int line) {
    if (line > 0 && line <= hashes.size()) {
      return Strings.nullToEmpty(hashes.get(line - 1));
    }
    return "";
  }
1149168
public static <C extends Collection<String>> C splitString(String line, char delim, C words) {
		return splitString(line, 0, line.length(), delim, words);
	}
668530
public static List<Object> parseCSVLine(String line, String separatorRegex) {
        List<Object> matches = new ArrayList<>();
        int currentPosition = 0;
        Matcher separatorMatcher = Pattern.compile("^" + separatorRegex).matcher(line);
        Matcher stringMatcher = Pattern.compile("^" + QUOTED_STRING_REGEX).matcher(line);
        Matcher doubleMatcher = Pattern.compile("^" + DOUBLE_REGEX).matcher(line);
        while (currentPosition < line.length()) {
            if (stringMatcher.region(currentPosition, line.length()).useAnchoringBounds(true).find()) {
                // Found String match
                String token = line.substring(currentPosition + 1, stringMatcher.end() - 1);
                matches.add(unescapeString(token));
                currentPosition = stringMatcher.end();
            } else if (doubleMatcher.region(currentPosition, line.length()).useAnchoringBounds(true).find()) {
                // Found Double match
                Double token = Double.parseDouble(line.substring(currentPosition, doubleMatcher.end()));
                matches.add(token);
                currentPosition = doubleMatcher.end();
            } else {
                throw new IllegalArgumentException("Can't parse line: expected token at " + currentPosition + " (" + line + ")");
            }

            if (currentPosition < line.length()) {
                if (!separatorMatcher.region(currentPosition, line.length()).useAnchoringBounds(true).find()) {
                    throw new IllegalArgumentException("Can't parse line: expected separator at " + currentPosition + " (" + line + ")");
                }
                currentPosition = separatorMatcher.end();
            }
        }
        return matches;
    }
391028
public static List<String> parse(String line)
	{
		
		if(line == null || line.length() ==0)
			return null;
		
		final short START = 2;
		final short TERM = 3;
		final short QUOTED_TERM = 4;
		final short start_ESCAPEDDOUBLEQUOTE =5;
		
		short state = START;
		
		int length = line.length();
		ArrayList<String> tokens = new ArrayList<>(10);
		
		StringBuilder buffer = new StringBuilder();
		
		char currentChar;
		for (int i = 0; i < length; i++)
		{
			currentChar = line.charAt(i);
			
			switch(state)
			{
				case START:
					if(currentChar == '"')
					{
						state = QUOTED_TERM;
					}
					else if(currentChar != ',')
					{
						  state = TERM;
						  buffer.append(currentChar);
					}

				break; 
				case QUOTED_TERM:
					if(currentChar != '"')
					{
						buffer.append(currentChar);
					}
					else
					{
						if(line.length() > (i+ 1) && line.charAt(i+1) != '"')
						{
							state = START;
							tokens.add(buffer.toString());
							buffer.setLength(0);							
						}
						else if(line.length() > (i+ 1) && line.charAt(i+1) == '"')
						{
							state = start_ESCAPEDDOUBLEQUOTE;
						}
					}
				break;
				case start_ESCAPEDDOUBLEQUOTE:
					
					buffer.append(currentChar);

					state = QUOTED_TERM;
				break;
				case TERM: 
					if(currentChar == ',')
					{
						state = START;
						
						if(buffer.length() > 0)
						{
							tokens.add(buffer.toString());
							buffer.setLength(0);
						}
						
					}
					else if(currentChar == '"' && line.charAt(i+1) == '"' )
					{
						state = start_ESCAPEDDOUBLEQUOTE;
					}
					else
							buffer.append(line.charAt(i));
				break;
				default: throw new RuntimeException("Unknown parse state:"+state);
			}
		}
		
		if(buffer.length() > 0)
			tokens.add(buffer.toString());
			
		tokens.trimToSize();
		
		if(tokens.isEmpty())
			return null;
		
		return tokens;
	
	}
1311437
private ShellCommand getCommandForLine(final String line) {

		final int pos                             = line.indexOf(" ");
		final String commandString                = pos > 0 ? line.substring(0, pos) : line;
		final Class<? extends ShellCommand> clazz = commands.get(commandString);

		if (clazz != null) {

			try {

				return clazz.newInstance();

			} catch (Throwable t) {
				logger.warn("", t);
			}
		}

		return null;
	}
1205516
def _parse_line(line=''):
    '''
    
    '''
    parts = line.split()
    key = parts.pop(0)
    value = ' '.join(parts)
    return key, value
936710
public synchronized void parseLine(String line) throws SyntaxErrorException
	{
		if (null != getParserOutcome() && isParserOutcomeMultipleLine())
		{
			parseLine__multipleLineMode(line);
		}
		else
		{
			parseLine__singleLineMode(line);
		}
	}
584284
protected ExpiresConfiguration parseExpiresConfiguration(String line) {
        line = line.trim();

        StringTokenizer tokenizer = new StringTokenizer(line, " ");

        String currentToken;

        try {
            currentToken = tokenizer.nextToken();
        } catch (NoSuchElementException e) {
            throw new IllegalStateException("Starting point (access|now|modification|a<seconds>|m<seconds>) not found in directive '"
                    + line + "'");
        }

        StartingPoint startingPoint;
        if ("access".equalsIgnoreCase(currentToken) || "now".equalsIgnoreCase(currentToken)) {
            startingPoint = StartingPoint.ACCESS_TIME;
        } else if ("modification".equalsIgnoreCase(currentToken)) {
            startingPoint = StartingPoint.LAST_MODIFICATION_TIME;
        } else if (!tokenizer.hasMoreTokens() && startsWithIgnoreCase(currentToken, "a")) {
            startingPoint = StartingPoint.ACCESS_TIME;
            // trick : convert duration configuration from old to new style
            tokenizer = new StringTokenizer(currentToken.substring(1) + " seconds", " ");
        } else if (!tokenizer.hasMoreTokens() && startsWithIgnoreCase(currentToken, "m")) {
            startingPoint = StartingPoint.LAST_MODIFICATION_TIME;
            // trick : convert duration configuration from old to new style
            tokenizer = new StringTokenizer(currentToken.substring(1) + " seconds", " ");
        } else {
            throw new IllegalStateException("Invalid starting point (access|now|modification|a<seconds>|m<seconds>) '" + currentToken
                    + "' in directive '" + line + "'");
        }

        try {
            currentToken = tokenizer.nextToken();
        } catch (NoSuchElementException e) {
            throw new IllegalStateException("Duration not found in directive '" + line + "'");
        }

        if ("plus".equalsIgnoreCase(currentToken)) {
            // skip
            try {
                currentToken = tokenizer.nextToken();
            } catch (NoSuchElementException e) {
                throw new IllegalStateException("Duration not found in directive '" + line + "'");
            }
        }

        List<Duration> durations = new ArrayList<Duration>();

        while (currentToken != null) {
            int amount;
            try {
                amount = Integer.parseInt(currentToken);
            } catch (NumberFormatException e) {
                throw new IllegalStateException("Invalid duration (number) '" + currentToken + "' in directive '" + line + "'");
            }

            try {
                currentToken = tokenizer.nextToken();
            } catch (NoSuchElementException e) {
                throw new IllegalStateException("Duration unit not found after amount " + amount + " in directive '" + line + "'");
            }
            DurationUnit durationUnit;
            if ("year".equalsIgnoreCase(currentToken) || "years".equalsIgnoreCase(currentToken)) {
                durationUnit = DurationUnit.YEAR;
            } else if ("month".equalsIgnoreCase(currentToken) || "months".equalsIgnoreCase(currentToken)) {
                durationUnit = DurationUnit.MONTH;
            } else if ("week".equalsIgnoreCase(currentToken) || "weeks".equalsIgnoreCase(currentToken)) {
                durationUnit = DurationUnit.WEEK;
            } else if ("day".equalsIgnoreCase(currentToken) || "days".equalsIgnoreCase(currentToken)) {
                durationUnit = DurationUnit.DAY;
            } else if ("hour".equalsIgnoreCase(currentToken) || "hours".equalsIgnoreCase(currentToken)) {
                durationUnit = DurationUnit.HOUR;
            } else if ("minute".equalsIgnoreCase(currentToken) || "minutes".equalsIgnoreCase(currentToken)) {
                durationUnit = DurationUnit.MINUTE;
            } else if ("second".equalsIgnoreCase(currentToken) || "seconds".equalsIgnoreCase(currentToken)) {
                durationUnit = DurationUnit.SECOND;
            } else {
                throw new IllegalStateException("Invalid duration unit (years|months|weeks|days|hours|minutes|seconds) '" + currentToken
                        + "' in directive '" + line + "'");
            }

            Duration duration = new Duration(amount, durationUnit);
            durations.add(duration);

            if (tokenizer.hasMoreTokens()) {
                currentToken = tokenizer.nextToken();
            } else {
                currentToken = null;
            }
        }

        return new ExpiresConfiguration(startingPoint, durations);
    }
619359
public static CaptureSearchResult parseCDXLineFlexFast(String line) {	
		CaptureSearchResult result = new FastCaptureSearchResult();
		return parseCDXLineFlex(line, result);
	}
8204
private IAtomContainer readSmiles(final String line) {
        try {
            return sp.parseSmiles(line);
        } catch (CDKException e) {
            logger.error("Error while reading the SMILES from: " + line + ", ", e);
            final IAtomContainer empty = builder.newInstance(IAtomContainer.class, 0, 0, 0, 0);
            empty.setProperty(BAD_SMILES_INPUT, line);
            return empty;
        }
    }
495589
public static CaptureSearchResult parseCDXLineFlex(String line) {
		CaptureSearchResult result = new CaptureSearchResult();
		return parseCDXLineFlex(line, result);
	}
1340462
private URLPatternHolder convertStringToPattern(String line) {
        URLPatternHolder holder = new URLPatternHolder();
        Pattern compiledPattern;
        Perl5Compiler compiler = new Perl5Compiler();
        String perl5RegExp = line;
        try {
            compiledPattern = compiler.compile(perl5RegExp, Perl5Compiler.READ_ONLY_MASK);
            holder.setCompiledPattern(compiledPattern);
        } catch (MalformedPatternException mpe) {
            throw new IllegalArgumentException("Malformed regular expression: " + perl5RegExp);
        }

        if (logger.isDebugEnabled()) {
            logger.debug("Added regular expression: " + compiledPattern.getPattern().toString());
        }
        return holder;
    }
823966
def parse_line(line):
  
  columns = line.split()
  token = columns.pop(0)
  values = [float(column) for column in columns]
  return token, values
1145553
private String readCommand(String line) throws CDKException {
        if (line.startsWith("M  V30 ")) {
            String command = line.substring(7);
            if (command.endsWith("-")) {
                command = command.substring(0, command.length() - 1);
                command += readCommand(readLine());
            }
            return command;
        } else {
            throw new CDKException("Could not read MDL file: unexpected line: " + line);
        }
    }
101456
private String getTextLine(String[] textLines, int line)
	{
		return (isIgnoreTrailingWhiteSpaces()) ? textLines[line].trim() : textLines[line];
	}
746737
void parseLine(String line) throws UnsupportedEncodingException {
    String[] splits = line.split(" ");

    boolean isDir = "dir".equals(splits[1]) ? true: false;
    if (!isDir && splits.length >= 6) {
      String name = URLDecoder.decode(splits[0], "UTF-8");
      String partName = URLDecoder.decode(splits[2], "UTF-8");
      long startIndex = Long.parseLong(splits[3]);
      long length = Long.parseLong(splits[4]);
      String[] newsplits = URLDecoder.decode(splits[5],"UTF-8").split(" ");
      if (newsplits != null && newsplits.length >= 5) {
        long mtime = Long.parseLong(newsplits[0]);
        IndexEntry entry = new IndexEntry(
          name, startIndex, length, mtime, partName);
        entries.add(entry);
      }
    }
  }