public AbstractBounds deserialize(DataInput in) throws IOException { if (in.readInt() == Type.RANGE.ordinal()) return new Range(Token.serializer().deserialize(in), Token.serializer().deserialize(in)); return new Bounds(Token.serializer().deserialize(in), Token.serializer().deserialize(in)); }
public void serialize(AbstractBounds range, DataOutput out) throws IOException { out.writeInt(range instanceof Range ? Type.RANGE.ordinal() : Type.BOUNDS.ordinal()); Token.serializer().serialize(range.left, out); Token.serializer().serialize(range.right, out); }