1 11 package org.eclipse.jdi.internal.request; 12 13 14 import java.io.DataInputStream ; 15 import java.io.DataOutputStream ; 16 import java.io.IOException ; 17 18 import org.eclipse.jdi.internal.MirrorImpl; 19 20 public class RequestID { 21 22 private static final int NULL_REQUEST_ID = 0; 23 public static final RequestID nullID = new RequestID(NULL_REQUEST_ID); 24 25 26 private int fRequestID; 27 28 31 private RequestID(int ID) { 32 fRequestID = ID; 33 } 34 35 38 public boolean isNull() { 39 return fRequestID == NULL_REQUEST_ID; 40 } 41 42 46 public boolean equals(Object object) { 47 return object != null && object.getClass().equals(this.getClass()) && fRequestID == ((RequestID)object).fRequestID; 48 } 49 50 54 public int hashCode() { 55 return fRequestID; 56 } 57 58 61 public String toString() { 62 return new Long (fRequestID).toString(); 63 } 64 65 68 public void write(MirrorImpl target, DataOutputStream out) throws IOException { 69 target.writeInt(fRequestID, "request ID", out); } 71 72 75 public static RequestID read(MirrorImpl target, DataInputStream in) throws IOException { 76 int result = target.readInt("request ID", in); return new RequestID(result); 78 } 79 } 80 | Popular Tags |