1 24 25 package org.objectweb.dream.protocol; 26 27 import java.io.IOException ; 28 import java.io.ObjectInput ; 29 import java.io.ObjectOutput ; 30 import java.io.Serializable ; 31 32 36 public class ProcessImpl implements Cloneable , 37 Serializable , Process , Comparable 39 { 40 41 45 protected short id; 46 47 52 public ProcessImpl(short id) 53 { 54 this.id = id; 55 } 56 57 61 66 public final short getId() 67 { 68 return id; 69 } 70 71 74 public void setId(short id) 75 { 76 this.id = id; 77 } 78 79 82 public Object clone() throws CloneNotSupportedException 83 { 84 return super.clone(); 85 } 86 87 91 94 public void writeExternal(ObjectOutput out) throws IOException 95 { 96 out.writeShort(id); 97 } 98 99 102 public void readExternal(ObjectInput in) throws IOException , 103 ClassNotFoundException 104 { 105 id = in.readShort(); 106 } 107 108 112 115 public boolean equals(Object arg0) 116 { 117 if (arg0 instanceof Process ) 118 { 119 boolean res = ((ProcessImpl ) arg0).id == id; 120 return res; 121 } 122 else 123 { 124 return false; 125 } 126 } 127 128 131 public int hashCode() 132 { 133 return id; 134 } 135 136 140 143 public int compareTo(Object o) 144 { 145 return (((Process ) o).getId() - getId()); 146 } 147 148 } | Popular Tags |