Ejemplo n.º 1
0
 boolean alike(LockEdge other, ContextReaderIfc reader) {
   /*
    * TODO Some kind of cache to improve performance? Note that the context
    * IDs are not declared final.
    */
   LockingContext thisSourceContext = reader.readContext(mSourceContextId);
   LockingContext otherSourceContext = reader.readContext(other.mSourceContextId);
   LockingContext thisTargetContext = reader.readContext(mTargetContextId);
   LockingContext otherTargetContext = reader.readContext(other.mTargetContextId);
   return thisSourceContext.alike(otherSourceContext)
       && thisTargetContext.alike(otherTargetContext)
       && mSource.alike(other.mSource, reader)
       && mTarget.alike(other.mTarget, reader);
 }
Ejemplo n.º 2
0
 public boolean equals(Object obj) {
   /*
    * TODO It might be a potential problem to use LockEdges in HashMaps
    * since they are mutable and this equals method depends on them?
    */
   try {
     LockEdge other = (LockEdge) obj;
     return (mTarget.getLockId() == other.mTarget.getLockId())
         && (mSource.getLockId() == other.mSource.getLockId())
         && (mThreadId == other.mThreadId)
         && (mSourceContextId == other.mSourceContextId)
         && (mTargetContextId == other.mTargetContextId);
   } catch (Exception e) {
     return false;
   }
 }
Ejemplo n.º 3
0
 public int hashCode() {
   // TODO Improve hashCode algorithm to improve performance?
   return mTarget.getLockId() + mSource.getLockId();
 }