public void write(DataOutput out) throws IOException {
   out.writeBoolean(isNode);
   if (node != null) {
     node.write(out);
   } else {
     contribution.write(out);
   }
 }
 public void readFields(DataInput in) throws IOException {
   isNode = in.readBoolean();
   if (isNode) {
     node = new PageRankNode();
     node.readFields(in);
   } else {
     contribution = new Contribution();
     contribution.readFields(in);
   }
 }