org.modeshape.graph.query.model
Class Limit

java.lang.Object
  extended by org.modeshape.graph.query.model.Limit
All Implemented Interfaces:
Serializable, LanguageObject, Visitable
Direct Known Subclasses:
JcrLimit

@Immutable
public class Limit
extends Object
implements LanguageObject

See Also:
Serialized Form

Field Summary
static Limit NONE
           
 
Constructor Summary
Limit(int rowLimit)
          Create a limit on the number of rows.
Limit(int rowLimit, int offset)
          Create a limit on the number of rows and the number of initial rows to skip.
 
Method Summary
 void accept(Visitor visitor)
          Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.
 boolean equals(Object obj)
          
 int hashCode()
          
 boolean hasRowLimited()
          Determine whether this limit clause defines a maximum limit
 boolean isOffset()
          Determine whether this limit clause defines an offset.
 boolean isUnlimited()
          Determine whether this limit clause is necessary.
 int offset()
          Get the number of rows skipped before the results begin.
 int rowLimit()
          Get the maximum number of rows that are to be returned.
 String toString()
          
 Limit withOffset(int offset)
           
 Limit withRowLimit(int rowLimit)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final Limit NONE
Constructor Detail

Limit

public Limit(int rowLimit)
Create a limit on the number of rows.

Parameters:
rowLimit - the maximum number of rows
Throws:
IllegalArgumentException - if the row limit is negative

Limit

public Limit(int rowLimit,
             int offset)
Create a limit on the number of rows and the number of initial rows to skip.

Parameters:
rowLimit - the maximum number of rows
offset - the number of rows to skip before beginning the results
Throws:
IllegalArgumentException - if the row limit is negative, or if the offset is negative
Method Detail

offset

public final int offset()
Get the number of rows skipped before the results begin.

Returns:
the offset; always 0 or a positive number

rowLimit

public final int rowLimit()
Get the maximum number of rows that are to be returned.

Returns:
the maximum number of rows; never negative, or equal to Integer.MAX_VALUE if there is no limit

isUnlimited

public final boolean isUnlimited()
Determine whether this limit clause is necessary.

Returns:
true if the number of rows is not limited and there is no offset, or false otherwise

hasRowLimited

public final boolean hasRowLimited()
Determine whether this limit clause defines a maximum limit

Returns:
true if the number of rows are limited, or false if there is no limit to the number of rows

isOffset

public final boolean isOffset()
Determine whether this limit clause defines an offset.

Returns:
true if there is an offset, or false if there is no offset

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()

hashCode

public int hashCode()

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

accept

public void accept(Visitor visitor)
Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.

Specified by:
accept in interface Visitable
Parameters:
visitor - the visitor; never null
See Also:
Visitable.accept(org.modeshape.graph.query.model.Visitor)

withRowLimit

public Limit withRowLimit(int rowLimit)

withOffset

public Limit withOffset(int offset)


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.