
it.tidalwave.bluebill.taxonomy.mobile.Taxon Maven / Gradle / Ivy
/***********************************************************************************************************************
*
* blueBill Mobile - Android - open source birding
* Copyright (C) 2009-2011 by Tidalwave s.a.s. (http://www.tidalwave.it)
*
***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************
*
* WWW: http://bluebill.tidalwave.it/mobile
* SCM: https://java.net/hg/bluebill-mobile~android-src
*
**********************************************************************************************************************/
package it.tidalwave.bluebill.taxonomy.mobile;
import javax.annotation.Nonnull;
import java.util.Locale;
import java.io.Serializable;
import it.tidalwave.util.As;
import it.tidalwave.util.Finder;
import it.tidalwave.util.Id;
import it.tidalwave.util.NotFoundException;
/***********************************************************************************************************************
*
* @author Fabrizio Giudici
* @version $Id$
*
**********************************************************************************************************************/
public interface Taxon extends As, Serializable // TODO: merge with it.tidalwave.taxonomy.Taxon
{
public static final Class Taxon = Taxon.class;
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
public static enum Rank implements Serializable
{
// it.tidalwave.taxonomy.Taxon.Rank also has SUBFAMILY
// Probably we should encapsulate getNarrower() in a specific function for blueBill
CLASS, ORDER, FAMILY, GENUS, SPECIES, SUBSPECIES;
private static final long serialVersionUID = 6079865922121355L;
@Nonnull
public Rank getBroader()
throws NotFoundException
{
final int broaderIndex = this.ordinal() - 1;
if (broaderIndex < 0)
{
throw new NotFoundException("No broader for " + this);
}
return values()[broaderIndex];
}
@Nonnull
public Rank getNarrower()
throws NotFoundException
{
final int narrowerIndex = this.ordinal() + 1;
if (narrowerIndex >= values().length)
{
throw new NotFoundException("No narrower for " + this);
}
return values()[narrowerIndex];
}
}
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Nonnull
public Finder findSubTaxa();
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Nonnull
public Id getId();
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Nonnull
public Taxon getParent()
throws NotFoundException;
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Nonnull
public Id getScientificNameId();
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Nonnull
public String getScientificName();
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Nonnull
public String getSpecificEpithet();
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Nonnull
public String getDisplayName (@Nonnull Locale locale)
throws NotFoundException;
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Nonnull
public Rank getRank();
public Taxon getAnonymousSynonym()
throws NotFoundException;
@Nonnull
// FIXME: return a Finder
public Object getSynonyms();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy