commit | dc579c580a90815b03ed09d558e76942491988bd | [log] [tgz] |
---|---|---|
author | Charles Chan <rascov@gmail.com> | Tue Aug 28 13:49:29 2018 -0700 |
committer | Charles Chan <charles@opennetworking.org> | Wed Aug 29 19:07:02 2018 +0000 |
tree | 010bd4fe4e292b6b6a08808df4bf6ec8f20d92c0 | |
parent | 277ec4e2f42048d7ff79a14c921d00a7c671bc0c [diff] [blame] |
Implement compareTo for TableId to avoid IllegalArgumentException java.lang.IllegalArgumentException: Comparison method violates its general contract! Change-Id: I4033e9a6743f134583eab936de2b960d76274919
diff --git a/core/api/src/main/java/org/onosproject/net/flow/IndexTableId.java b/core/api/src/main/java/org/onosproject/net/flow/IndexTableId.java index fab2463..7b49d98 100644 --- a/core/api/src/main/java/org/onosproject/net/flow/IndexTableId.java +++ b/core/api/src/main/java/org/onosproject/net/flow/IndexTableId.java
@@ -32,6 +32,16 @@ return Type.INDEX; } + @Override + public int compareTo(TableId other) { + if (this.type() != other.type()) { + return this.type().compareTo(other.type()); + } else { + IndexTableId indexTableId = (IndexTableId) other; + return this.id() - indexTableId.id(); + } + } + /** * Returns a table identifier for the given index. *