Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  *  Android Wheel Control.
  *  https://code.google.com/p/android-wheel/
  *  
  *  Copyright 2011 Yuri Kanivets
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
  *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package kankan.wheel.widget;

Range for visible items.
public class ItemsRange {
	// First item number
	private int first;
	// Items count
	private int count;

Default constructor. Creates an empty range
    public ItemsRange() {
        this(0, 0);
    }
    
Constructor

Parameters:
first the number of first item
count the count of items
	public ItemsRange(int firstint count) {
		this. = first;
		this. = count;
	}

Gets number of first item

Returns:
the number of the first item
	public int getFirst() {
		return ;
	}

Gets number of last item

Returns:
the number of last item
	public int getLast() {
		return getFirst() + getCount() - 1;
	}

Get items count

Returns:
the count of items
	public int getCount() {
		return ;
	}

Tests whether item is contained by range

Parameters:
index the item number
Returns:
true if item is contained
	public boolean contains(int index) {
		return index >= getFirst() && index <= getLast();
	}
New to GrepCode? Check out our FAQ X