- Timestamp:
- 07/14/13 23:20:04 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/communication/Request.java
r99 r101 7 7 import com.framsticks.util.FramsticksException; 8 8 import com.framsticks.util.lang.Pair; 9 import com.framsticks.util.lang.Strings; 9 10 10 11 /** … … 78 79 } 79 80 80 public static CharSequence takeGroup(CharSequence input, Matcher matcher, int group) {81 // return (matcher.start(group) == matcher.end(group)) ? null : input.subSequence(matcher.start(group), matcher.end(group));82 return input.subSequence(matcher.start(group), matcher.end(group));83 }84 81 85 82 public static Pair<CharSequence, CharSequence> takeString(CharSequence line) { … … 89 86 } 90 87 assert ((matcher.start(1) == -1) != (matcher.start(2) == -1)); 91 return new Pair<CharSequence, CharSequence>( takeGroup(line, matcher, (matcher.start(1) != -1 ? 1 : 2)),takeGroup(line, matcher, 3));88 return new Pair<CharSequence, CharSequence>(Strings.takeGroup(line, matcher, (matcher.start(1) != -1 ? 1 : 2)), Strings.takeGroup(line, matcher, 3)); 92 89 } 93 90 94 protected static final Pattern REQUEST_ID_BREAKER_PATTERN = Pattern.compile("^\\s*( [0-9]+)\\s*(.*)$");91 protected static final Pattern REQUEST_ID_BREAKER_PATTERN = Pattern.compile("^\\s*(-?[0-9]+)\\s*(.*)$"); 95 92 96 93 protected final static Pair<Integer, CharSequence> takeRequestId(boolean withId, CharSequence line) { … … 100 97 return null; 101 98 } 102 return new Pair<Integer, CharSequence>(Integer.valueOf( takeGroup(line, matcher, 1).toString()),takeGroup(line, matcher, 2));99 return new Pair<Integer, CharSequence>(Integer.valueOf(Strings.takeGroup(line, matcher, 1).toString()), Strings.takeGroup(line, matcher, 2)); 103 100 } 104 101 return new Pair<Integer, CharSequence>(null, line);
Note: See TracChangeset
for help on using the changeset viewer.