com.xpn.xwiki.criteria.impl
Class Range

java.lang.Object
  extended by com.xpn.xwiki.criteria.impl.Range

public class Range
extends Object

Immutable continuous integer range. It can be used for pagination


Constructor Summary
Range(int start, int size)
          Creates a new interval having the specified start and size.
 
Method Summary
 int getAbsoluteSize()
           
 int getAbsoluteStart()
           
 int getSize()
           
 int getStart()
           
 List<String> subList(List<String> list)
          Copy the given list and return a (smart) subList corresponding to this range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Range

public Range(int start,
             int size)
Creates a new interval having the specified start and size.

Parameters:
start - The start of the interval
size - The size of the interval
Method Detail

getStart

public int getStart()
See Also:
start

getAbsoluteStart

public int getAbsoluteStart()
Returns:
The absolute value (nonnegative) of this interval's start

getSize

public int getSize()
See Also:
size

getAbsoluteSize

public int getAbsoluteSize()
Returns:
The absolute value (nonnegative) of this interval's size

subList

public List<String> subList(List<String> list)
Copy the given list and return a (smart) subList corresponding to this range. If the absolute size of this range is 0 (ALL) it returns an unmodified copy.

Considering this 9 elements list : [0, 1, 2, 3, 4, 5, 6, 7, 8]

Parameters:
list - the list from which the sublist will be extracted
Returns:
a sublist of the given list computed from this range


Copyright © 2004-2013 XWiki. All Rights Reserved.