it.tidalwave.bluebill.taxonomy.elmo.impl.XXXFinder Maven / Gradle / Ivy
/***********************************************************************************************************************
*
* blueBill Mobile - open source birdwatching
* ==========================================
*
* Copyright (C) 2009, 2010 by Tidalwave s.a.s. (http://www.tidalwave.it)
* http://bluebill.tidalwave.it/mobile/
*
***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************
*
* $Id: XXXFinder.java,v 31ee4e8a62bc 2010/07/17 14:44:24 fabrizio $
*
**********************************************************************************************************************/
package it.tidalwave.bluebill.taxonomy.elmo.impl;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import it.tidalwave.util.Finder;
import it.tidalwave.util.Finder.SortDirection;
import it.tidalwave.util.Finder.SortCriterion;
import it.tidalwave.util.NotFoundException;
/**
*
* @author fritz
*/
public class XXXFinder implements it.tidalwave.util.Finder
{
private final List list;
public XXXFinder (@Nonnull final List list)
{
this.list = list;
}
@Override
public int count()
{
return list.size();
}
@Override
public Finder from (int index)
{
return new XXXFinder(list.subList(index, list.size() - 1));
}
@Override
public it.tidalwave.util.Finder max (int size)
{
return new XXXFinder(list.subList(0, size - 1));
}
@Override
public T result() throws NotFoundException
{
if (list.size() == 0)
{
throw new NotFoundException();
}
return list.get(0); // FIXME: size check?
}
@Override
public List extends T> results()
{
return new CopyOnWriteArrayList(list);
}
@Override
public Finder sort (@Nonnull final SortCriterion sortCriterion,
@Nonnull final SortDirection sortDirection)
{
return this; // FIXME
}
@Override
public Finder sort (@Nonnull final SortCriterion sortCriterion)
{
return sort(sortCriterion, SortDirection.ASCENDING);
}
public Finder ofType (Class type)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public T firstResult()
throws NotFoundException
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy