diff options
author | Michael Bien <[email protected]> | 2010-01-12 19:53:13 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-01-12 19:53:13 +0100 |
commit | 3d01c2c74e282c19e9286d4f4509bef8302ca93e (patch) | |
tree | e9f6e0da1877776ca9851600d1f6e02ba189cfd1 /src/com/mbien/opencl/CLEvent.java | |
parent | 286f94a7b148856666d7c05853ba9b2ba799b638 (diff) |
introduced CLEventList, an optimized nio collecton for storing CLEvents.
added hashCode() and equals() to CLEvent.
CLEvent support in CLCommandQueue.
Several NIO optimizations.
Diffstat (limited to 'src/com/mbien/opencl/CLEvent.java')
-rw-r--r-- | src/com/mbien/opencl/CLEvent.java | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/com/mbien/opencl/CLEvent.java b/src/com/mbien/opencl/CLEvent.java index c4b62917..45117bc6 100644 --- a/src/com/mbien/opencl/CLEvent.java +++ b/src/com/mbien/opencl/CLEvent.java @@ -17,7 +17,7 @@ public class CLEvent implements CLResource { private final CLEventInfoAccessor eventInfo; - CLEvent(CLContext context, int id) { + CLEvent(CLContext context, long id) { this.context = context; this.cl = context.cl; this.ID = id; @@ -38,6 +38,41 @@ public class CLEvent implements CLResource { return CommandType.valueOf(status); } + @Override + public String toString() { + return "CLEvent [id: " + ID + + " name: " + getType() + + " status: " + getStatus()+"]"; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CLEvent other = (CLEvent) obj; + if (this.context != other.context && (this.context == null || !this.context.equals(other.context))) { + return false; + } + if (this.ID != other.ID) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 13 * hash + (this.context != null ? this.context.hashCode() : 0); + hash = 13 * hash + (int) (this.ID ^ (this.ID >>> 32)); + return hash; + } + + + private class CLEventInfoAccessor extends CLInfoAccessor { @Override |