Example #1
0
 public static FoodMessage deserialize(long number) {
   FoodMessage fm = new FoodMessage();
   fm._quantity = FoodQuantity.deserialize((int) ((number & FIELD_MASK_FOOD_QUANTITY) >> 3));
   fm._location = Location.deserialize((int) (number & FIELD_MASK_FOOD_LOCATION) >> 6);
   fm._time = (int) ((number >> 26) & FIELD_MASK_TIME);
   return fm;
 }
Example #2
0
 public long serialize() {
   long number = MessageType.FOOD.serialize();
   number = number | (_quantity.serialize() << 3);
   number = number | (_location.serialize() << 6);
   number = number | (((long) _time) << 26);
   return number;
 }