@Test public void composeExpandableChildId_GroupIdMaxOutOfRange() throws Exception { thrown.expect(IllegalArgumentException.class); ItemIdComposer.composeExpandableChildId(ItemIdComposer.MAX_GROUP_ID + 1, 0); }
public static long composeExpandableChildId(@IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) long groupId, @IntRange(from = MIN_CHILD_ID, to = MAX_CHILD_ID) long childId) { if (groupId < MIN_GROUP_ID || groupId > MAX_GROUP_ID) { throw new IllegalArgumentException("Group ID value is out of range. (groupId = " + groupId + ")"); } if (childId < MIN_CHILD_ID || childId > MAX_CHILD_ID) { throw new IllegalArgumentException("Child ID value is out of range. (childId = " + childId + ")"); } return ((groupId << BIT_OFFSET_GROUP_ID) & BIT_MASK_GROUP_ID) | ((childId << BIT_OFFSET_CHILD_ID) & BIT_MASK_CHILD_ID); }
ItemIdComposer { public static long composeExpandableChildId(@IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) long groupId, @IntRange(from = MIN_CHILD_ID, to = MAX_CHILD_ID) long childId) { if (groupId < MIN_GROUP_ID || groupId > MAX_GROUP_ID) { throw new IllegalArgumentException("Group ID value is out of range. (groupId = " + groupId + ")"); } if (childId < MIN_CHILD_ID || childId > MAX_CHILD_ID) { throw new IllegalArgumentException("Child ID value is out of range. (childId = " + childId + ")"); } return ((groupId << BIT_OFFSET_GROUP_ID) & BIT_MASK_GROUP_ID) | ((childId << BIT_OFFSET_CHILD_ID) & BIT_MASK_CHILD_ID); } }
ItemIdComposer { public static long composeExpandableChildId(@IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) long groupId, @IntRange(from = MIN_CHILD_ID, to = MAX_CHILD_ID) long childId) { if (groupId < MIN_GROUP_ID || groupId > MAX_GROUP_ID) { throw new IllegalArgumentException("Group ID value is out of range. (groupId = " + groupId + ")"); } if (childId < MIN_CHILD_ID || childId > MAX_CHILD_ID) { throw new IllegalArgumentException("Child ID value is out of range. (childId = " + childId + ")"); } return ((groupId << BIT_OFFSET_GROUP_ID) & BIT_MASK_GROUP_ID) | ((childId << BIT_OFFSET_CHILD_ID) & BIT_MASK_CHILD_ID); } private  ItemIdComposer(); }
ItemIdComposer { public static long composeExpandableChildId(@IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) long groupId, @IntRange(from = MIN_CHILD_ID, to = MAX_CHILD_ID) long childId) { if (groupId < MIN_GROUP_ID || groupId > MAX_GROUP_ID) { throw new IllegalArgumentException("Group ID value is out of range. (groupId = " + groupId + ")"); } if (childId < MIN_CHILD_ID || childId > MAX_CHILD_ID) { throw new IllegalArgumentException("Child ID value is out of range. (childId = " + childId + ")"); } return ((groupId << BIT_OFFSET_GROUP_ID) & BIT_MASK_GROUP_ID) | ((childId << BIT_OFFSET_CHILD_ID) & BIT_MASK_CHILD_ID); } private  ItemIdComposer(); static long composeExpandableChildId(@IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) long groupId, @IntRange(from = MIN_CHILD_ID, to = MAX_CHILD_ID) long childId); static long composeExpandableGroupId(@IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) long groupId); static boolean isExpandableGroup(long composedId); @IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) static int extractSegmentPart(long composedId); @IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) static long extractExpandableGroupIdPart(long composedId); @IntRange(from = MIN_CHILD_ID, to = MAX_CHILD_ID) static long extractExpandableChildIdPart(long composedId); static long extractWrappedIdPart(long composedId); static long composeSegment(@IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) int segment, long wrappedId); }
ItemIdComposer { public static long composeExpandableChildId(@IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) long groupId, @IntRange(from = MIN_CHILD_ID, to = MAX_CHILD_ID) long childId) { if (groupId < MIN_GROUP_ID || groupId > MAX_GROUP_ID) { throw new IllegalArgumentException("Group ID value is out of range. (groupId = " + groupId + ")"); } if (childId < MIN_CHILD_ID || childId > MAX_CHILD_ID) { throw new IllegalArgumentException("Child ID value is out of range. (childId = " + childId + ")"); } return ((groupId << BIT_OFFSET_GROUP_ID) & BIT_MASK_GROUP_ID) | ((childId << BIT_OFFSET_CHILD_ID) & BIT_MASK_CHILD_ID); } private  ItemIdComposer(); static long composeExpandableChildId(@IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) long groupId, @IntRange(from = MIN_CHILD_ID, to = MAX_CHILD_ID) long childId); static long composeExpandableGroupId(@IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) long groupId); static boolean isExpandableGroup(long composedId); @IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) static int extractSegmentPart(long composedId); @IntRange(from = MIN_GROUP_ID, to = MAX_GROUP_ID) static long extractExpandableGroupIdPart(long composedId); @IntRange(from = MIN_CHILD_ID, to = MAX_CHILD_ID) static long extractExpandableChildIdPart(long composedId); static long extractWrappedIdPart(long composedId); static long composeSegment(@IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) int segment, long wrappedId); static final int BIT_OFFSET_RESERVED_SIGN_FLAG; static final int BIT_OFFSET_SEGMENT; static final int BIT_OFFSET_GROUP_ID; static final int BIT_OFFSET_CHILD_ID; static final int BIT_WIDTH_RESERVED_SIGN_FLAG; static final int BIT_WIDTH_SEGMENT; static final int BIT_WIDTH_GROUP_ID; static final int BIT_WIDTH_CHILD_ID; static final long BIT_MASK_RESERVED_SIGN_FLAG; static final long BIT_MASK_SEGMENT; static final long BIT_MASK_GROUP_ID; static final long BIT_MASK_CHILD_ID; static final int MIN_SEGMENT; static final int MAX_SEGMENT; static final long MIN_GROUP_ID; static final long MAX_GROUP_ID; static final long MIN_CHILD_ID; static final long MAX_CHILD_ID; static final long MIN_WRAPPED_ID; static final long MAX_WRAPPED_ID; }