package entity;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by Jakob Pfeiffer on 19.10.17.
 */
public abstract class BaseEntity implements Comparable<BaseEntity> {
	private long identity;
	private int version;
	private long creationTimestamp;
	Set<Message> messagesCaused;

	public BaseEntity() {
		this.version = 1;
		this.messagesCaused = new HashSet<>();
		this.creationTimestamp = System.currentTimeMillis();
	}

	public long getIdentity() {
		return identity;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public long getCreationTimestamp() {
		return creationTimestamp;
	}

	public Set<Message> getMessagesCaused() {
		return messagesCaused;
	}

	@Override
	public int compareTo(BaseEntity o) {
		return this.identity < ((BaseEntity) o).identity ? -1 : this.identity > ((BaseEntity) o).identity ? +1 : 0;
	}
}

@@ -794,23 +794,20 @@
  o) %7B%0A%09%09
-return 
+if (
 this.ide
@@ -816,26 +816,12 @@
 ity 
-%3C ((BaseEntity)
+==
  o
-)
 .ide
@@ -829,48 +829,55 @@
 tity
- ? -1 : this.identity %3E ((BaseEntity)
+) %7B%0A%09%09%09return 0;%0A%09%09%7D%0A%09%09return this.identity %3C
  o
-)
 .ide
@@ -888,14 +888,15 @@
 y ? 
-+
+-
 1 : 
-0
++1
 ;%0A%09%7D

Rewrite ternary operator. Remove unnecessary casting of the object to compare