You can implement arbitrary comparison algorithms using reflection (protobuf reflection, not Java reflection -- see the Message interface).
On Sat, Oct 17, 2009 at 10:34 AM, Michael <[email protected]> wrote: > > Thanks for the suggestion but unfortunately equals with not tell me GT > or LT. Furthmore the encoding scheme is not byte sortable. Take for > example varints which are LSB first, sint32 it uses a zig zag encoding > with -10 > 5, and strings which start with there length so "z" < "aa". > Not so good. Also double which are IEEE 754 are not byte comparable :- > ( > > Basically you need to walk the fields including nested types, and then > compare the primitives types, or bytes for strings. > > I wish it was so simple :-( > > On Oct 17, 6:03 pm, Jesper Eskilson <[email protected]> wrote: > > On Sat, Oct 17, 2009 at 6:25 PM, Michael <[email protected]> wrote: > > > > > int compare(byte[] b1, int s1, > > > byte[] b2, int s2, > > > Descriptors.Descriptor type) > > > > > > Can't you use Arrays#equals() for that? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---
