Skip to content

Commit

Permalink
Addressed a code review comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
nandita727 committed Feb 12, 2024
1 parent bb4ede4 commit 3f7fb3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/main/java/com/meta/cp4m/message/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
package com.meta.cp4m.message;

import com.meta.cp4m.Identifier;
import org.checkerframework.checker.lock.qual.NewObject;
import org.checkerframework.checker.nullness.qual.Nullable;

import java.time.Instant;

Expand Down Expand Up @@ -49,7 +47,7 @@ enum Role {
this.priority = priority;
}

public int getPriority(){
public int priority(){
return this.priority;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/meta/cp4m/message/ThreadState.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private ThreadState(ThreadState<T> current, ThreadState<T> old, T newMessage) {
MessageNode<T> mWithParentMessage = new MessageNode<>(newMessage,old.tail());
this.messageNodes =
Stream.concat(messageNodes.stream(), Stream.of(mWithParentMessage))
.sorted((m1,m2) -> m1.getParentMessage() == m2.getParentMessage() ? compare(m1.getMessage().role().getPriority(),m2.getMessage().role().getPriority()) : (m1.getMessage().timestamp().compareTo(m2.getMessage().timestamp())))
.sorted((m1,m2) -> m1.getParentMessage() == m2.getParentMessage() ? compare(m1.getMessage().role().priority(),m2.getMessage().role().priority()) : (m1.getMessage().timestamp().compareTo(m2.getMessage().timestamp())))
.collect(Collectors.toUnmodifiableList());

Preconditions.checkArgument(
Expand Down

0 comments on commit 3f7fb3d

Please sign in to comment.