Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed Oct 25, 2019
1 parent 2c71315 commit eef1751
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,12 @@ public boolean hasMultiLevelWildcard() {
return new MqttTopicLevels(Arrays.copyOfRange(array, start, allEnd), end - start);
}

public boolean forwardIfEqual(final @NotNull MqttTopicLevels topicLevels) {
final byte[] topicLevelsArray = topicLevels.getArray();
final int topicLevelsEnd = topicLevels.getEnd();
final int to = end + topicLevelsArray.length - topicLevelsEnd;
public boolean forwardIfEqual(final @NotNull MqttTopicLevels levels) {
final byte[] levelsArray = levels.getArray();
final int levelsEnd = levels.getEnd();
final int to = end + levelsArray.length - levelsEnd;
if ((to <= allEnd) && ((to == allEnd) || (array[to] == MqttTopic.TOPIC_LEVEL_SEPARATOR)) &&
ByteArrayUtil.equals(array, end + 1, to, topicLevelsArray, topicLevelsEnd + 1,
topicLevelsArray.length)) {
ByteArrayUtil.equals(array, end + 1, to, levelsArray, levelsEnd + 1, levelsArray.length)) {
start = end = to;
return true;
}
Expand Down

0 comments on commit eef1751

Please sign in to comment.