001// CandyEntry.java 002// 003// senger@ebi.ac.uk 004// February 2001 005// 006 007/* 008 * BioJava development code 009 * 010 * This code may be freely distributed and modified under the 011 * terms of the GNU Lesser General Public Licence. This should 012 * be distributed with the code. If you do not have a copy, 013 * see: 014 * 015 * http://www.gnu.org/copyleft/lesser.html 016 * 017 * Copyright for this code is held jointly by the individual 018 * authors. These should be listed in @author doc comments. 019 * 020 * For more information on the BioJava project and its aims, 021 * or to join the biojava-l mailing list, visit the home page 022 * at: 023 * 024 * http://www.biojava.org/ 025 * 026 */ 027package org.biojava.utils.candy; 028 029import java.util.Hashtable; 030 031/** 032 * <p> 033 * This is a basic container for a vocabulary entry. It consists only 034 * of the basic attributes which is sufficient for the vocabularies 035 * providing string-type contents. 036 * </p> 037 * 038 * <p> 039 * However, it may still accomodate more complex data types using 040 * the {@link #extras} member. 041 * </p> 042 * 043 * @author <A HREF="mailto:senger@ebi.ac.uk">Martin Senger</A> 044 * @version $Id$ 045 */ 046 047public class CandyEntry { 048 049 /** A unique identifier of this entry. */ 050 public String entry = ""; 051 052 /** A value of this entry. */ 053 public String description = ""; 054 055 /** A container for the additional properties represented by this entry. */ 056 public Hashtable extras = new Hashtable(); 057 058 /** An empty constructor. */ 059 public CandyEntry() { 060 } 061 062 /** It creates an entry instance with given name and empty value. */ 063 public CandyEntry (String entry) { 064 this (entry, "", null); 065 } 066 067 /** It creates an entry instance with given name and value. */ 068 public CandyEntry (String entry, String description) { 069 this (entry, description, null); 070 } 071 072 /** 073 * It creates an entry instance with given name, value and 074 * additional properties. 075 */ 076 public CandyEntry (String entry, String description, Hashtable extras) { 077 this.entry = entry; 078 this.description = description; 079 if (extras != null) 080 this.extras = extras; 081 } 082 083 /** It prints the entry contents. */ 084 public String toString() { 085 return entry + "\t" + description + 086 (extras != null && extras.size() > 0 ? 087 "\n\t" + extras.toString() : ""); 088 } 089}