mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
125783 rmunteanu: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127809 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
113 lines
2.1 KiB
Java
113 lines
2.1 KiB
Java
package org.alfresco.opencmis.search;
|
|
|
|
import java.util.ListIterator;
|
|
|
|
/**
|
|
* @author andyh
|
|
*/
|
|
public class CMISResultSetRowIterator implements ListIterator<CMISResultSetRow>
|
|
{
|
|
/**
|
|
* The result set
|
|
*/
|
|
private CMISResultSet resultSet;
|
|
|
|
/**
|
|
* The current position
|
|
*/
|
|
private int position = -1;
|
|
|
|
/**
|
|
* The maximum position
|
|
*/
|
|
private int max;
|
|
|
|
/**
|
|
* Create an iterator over the result set. Follows stadard ListIterator
|
|
* conventions
|
|
*
|
|
* @param resultSet CMISResultSet
|
|
*/
|
|
public CMISResultSetRowIterator(CMISResultSet resultSet)
|
|
{
|
|
this.resultSet = resultSet;
|
|
this.max = resultSet.getLength();
|
|
}
|
|
|
|
public CMISResultSet getResultSet()
|
|
{
|
|
return resultSet;
|
|
}
|
|
|
|
/*
|
|
* ListIterator implementation
|
|
*/
|
|
public boolean hasNext()
|
|
{
|
|
return position < (max - 1);
|
|
}
|
|
|
|
public boolean allowsReverse()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public boolean hasPrevious()
|
|
{
|
|
return position > 0;
|
|
}
|
|
|
|
public CMISResultSetRow next()
|
|
{
|
|
return resultSet.getRow(moveToNextPosition());
|
|
}
|
|
|
|
protected int moveToNextPosition()
|
|
{
|
|
return ++position;
|
|
}
|
|
|
|
public CMISResultSetRow previous()
|
|
{
|
|
return resultSet.getRow(moveToPreviousPosition());
|
|
}
|
|
|
|
protected int moveToPreviousPosition()
|
|
{
|
|
return --position;
|
|
}
|
|
|
|
public int nextIndex()
|
|
{
|
|
return position + 1;
|
|
}
|
|
|
|
public int previousIndex()
|
|
{
|
|
return position - 1;
|
|
}
|
|
|
|
/*
|
|
* Mutation is not supported
|
|
*/
|
|
|
|
public void remove()
|
|
{
|
|
// TODO Auto-generated method stub
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
public void set(CMISResultSetRow o)
|
|
{
|
|
// TODO Auto-generated method stub
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
public void add(CMISResultSetRow o)
|
|
{
|
|
// TODO Auto-generated method stub
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
}
|