@Test public void composeSegment_MaxOutOfRange() throws Exception { thrown.expect(IllegalArgumentException.class); ItemViewTypeComposer.composeSegment(ItemViewTypeComposer.MAX_SEGMENT + 1, 0); }
public static int composeSegment(@IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) int segment, int wrappedViewType) { if (segment < MIN_SEGMENT || segment > MAX_SEGMENT) { throw new IllegalArgumentException("Segment value is out of range. (segment = " + segment + ")"); } return (segment << BIT_OFFSET_SEGMENT) | (wrappedViewType & (BIT_MASK_EXPANDABLE_FLAG | BIT_MASK_WRAPPED_VIEW_TYPE)); }
ItemViewTypeComposer { public static int composeSegment(@IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) int segment, int wrappedViewType) { if (segment < MIN_SEGMENT || segment > MAX_SEGMENT) { throw new IllegalArgumentException("Segment value is out of range. (segment = " + segment + ")"); } return (segment << BIT_OFFSET_SEGMENT) | (wrappedViewType & (BIT_MASK_EXPANDABLE_FLAG | BIT_MASK_WRAPPED_VIEW_TYPE)); } }
ItemViewTypeComposer { public static int composeSegment(@IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) int segment, int wrappedViewType) { if (segment < MIN_SEGMENT || segment > MAX_SEGMENT) { throw new IllegalArgumentException("Segment value is out of range. (segment = " + segment + ")"); } return (segment << BIT_OFFSET_SEGMENT) | (wrappedViewType & (BIT_MASK_EXPANDABLE_FLAG | BIT_MASK_WRAPPED_VIEW_TYPE)); } private  ItemViewTypeComposer(); }
ItemViewTypeComposer { public static int composeSegment(@IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) int segment, int wrappedViewType) { if (segment < MIN_SEGMENT || segment > MAX_SEGMENT) { throw new IllegalArgumentException("Segment value is out of range. (segment = " + segment + ")"); } return (segment << BIT_OFFSET_SEGMENT) | (wrappedViewType & (BIT_MASK_EXPANDABLE_FLAG | BIT_MASK_WRAPPED_VIEW_TYPE)); } private  ItemViewTypeComposer(); @IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) static int extractSegmentPart(int composedViewType); @IntRange(from = MIN_WRAPPED_VIEW_TYPE, to = MAX_WRAPPED_VIEW_TYPE) static int extractWrappedViewTypePart(int composedViewType); static boolean isExpandableGroup(int composedViewType); static int composeSegment(@IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) int segment, int wrappedViewType); }
ItemViewTypeComposer { public static int composeSegment(@IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) int segment, int wrappedViewType) { if (segment < MIN_SEGMENT || segment > MAX_SEGMENT) { throw new IllegalArgumentException("Segment value is out of range. (segment = " + segment + ")"); } return (segment << BIT_OFFSET_SEGMENT) | (wrappedViewType & (BIT_MASK_EXPANDABLE_FLAG | BIT_MASK_WRAPPED_VIEW_TYPE)); } private  ItemViewTypeComposer(); @IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) static int extractSegmentPart(int composedViewType); @IntRange(from = MIN_WRAPPED_VIEW_TYPE, to = MAX_WRAPPED_VIEW_TYPE) static int extractWrappedViewTypePart(int composedViewType); static boolean isExpandableGroup(int composedViewType); static int composeSegment(@IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) int segment, int wrappedViewType); static final int BIT_OFFSET_EXPANDABLE_FLAG; static final int BIT_OFFSET_SEGMENT; static final int BIT_OFFSET_WRAPPED_VIEW_TYPE; static final int BIT_WIDTH_EXPANDABLE_FLAG; static final int BIT_WIDTH_SEGMENT; static final int BIT_WIDTH_WRAPPED_VIEW_TYPE; static final int BIT_MASK_EXPANDABLE_FLAG; static final int BIT_MASK_SEGMENT; static final int BIT_MASK_WRAPPED_VIEW_TYPE; static final int MIN_SEGMENT; static final int MAX_SEGMENT; static final int MIN_WRAPPED_VIEW_TYPE; static final int MAX_WRAPPED_VIEW_TYPE; }