예제 #1
0
 public SequenceSet deepCopy(SequenceSet value) {
   SequenceSet rc = new SequenceSet();
   Sequence sequence = value.getHead();
   while (sequence != null) {
     rc.add(new Sequence(sequence.first, sequence.last));
     sequence = sequence.getNext();
   }
   return rc;
 }
예제 #2
0
 public SequenceSet readPayload(DataInput in) throws IOException {
   SequenceSet value = new SequenceSet();
   int count = in.readInt();
   for (int i = 0; i < count; i++) {
     if (in.readBoolean()) {
       Sequence sequence = new Sequence(in.readLong(), in.readLong());
       value.addLast(sequence);
     } else {
       Sequence sequence = new Sequence(in.readLong());
       value.addLast(sequence);
     }
   }
   return value;
 }
예제 #3
0
 public void writePayload(SequenceSet value, DataOutput out) throws IOException {
   out.writeInt(value.size());
   Sequence sequence = value.getHead();
   while (sequence != null) {
     if (sequence.range() > 1) {
       out.writeBoolean(true);
       out.writeLong(sequence.first);
       out.writeLong(sequence.last);
     } else {
       out.writeBoolean(false);
       out.writeLong(sequence.first);
     }
     sequence = sequence.getNext();
   }
 }