/*
 * Copyright (c) 2009-2013 Topi Nieminen
 */
package fi.tnie.db.ent;

import java.io.Serializable;

public class FetchOptions
	implements Serializable
{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5894929494069252288L;
	private long offset;
	private Long pageSize;
	private Adjustment adjustment;
	private Long count;
	private boolean cardinality;
	
	enum Adjustment {
		NONE,
		AUTO
	}
	
	
	/**
	 * No-argument constructor for GWT Serialization
	 */
	protected FetchOptions() {
	}
	
	/**
	 * Negative offset is interpreted as an offset counting from the end.
	 * 
	 * @param pageSize
	 * @param offset
	 */	
	public FetchOptions(long pageSize, long offset) {
		this(pageSize, offset, Adjustment.AUTO, null, true);
	}
	
	public FetchOptions(long pageSize, long offset, Adjustment adjust, Long count, boolean cardinality) {
		super();
		this.offset = offset;
		this.pageSize = Long.valueOf(pageSize);
		this.adjustment = adjust;
		this.count = count;
		this.cardinality = cardinality;
	}
	
	public FetchOptions(long offset) {
		super();
		this.offset = offset;
		this.pageSize = null;
		this.adjustment = Adjustment.NONE;
	}


	public long getOffset() {
		return this.offset;
	}
	
	public Long getPageSize() {
		return pageSize;
	}
	
	public Adjustment getAdjustment() {
		return adjustment;
	}
	
	public Long getCount() {
		return count;
	}
	
	public boolean getCardinality() {
		return cardinality;		
	}
}

@@ -500,16 +500,111 @@
  %7B%0A%09%7D%0A%09%0A
+%09public FetchOptions(int pageSize, long offset) %7B%0A%09%09this(Long.valueOf(pageSize), offset);%0A%09%7D%0A%09%0A
 %09/**%0A%09 *
@@ -733,33 +733,33 @@
 ic FetchOptions(
-l
+L
 ong pageSize, lo
@@ -848,25 +848,25 @@
 etchOptions(
-l
+L
 ong pageSize
@@ -987,37 +987,24 @@
 eSize = 
-Long.valueOf(
 pageSize
 );%0A%09%09thi
@@ -995,17 +995,16 @@
 pageSize
-)
 ;%0A%09%09this

fix constructor