001    /**
002     * Copyright (C) 2010 The Roslin Institute <contact andy.law@roslin.ed.ac.uk>
003     *
004     * This file is part of the Ensembl Java API demonstration project developed by the
005     * Bioinformatics Group at The Roslin Institute, The Royal (Dick) School of
006     * Veterinary Studies, University of Edinburgh.
007     *
008     * This is free software: you can redistribute it and/or modify
009     * it under the terms of the GNU General Public License (version 3) as published by
010     * the Free Software Foundation.
011     *
012     * This software is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015     * GNU General Public License for more details.
016     *
017     * You should have received a copy of the GNU General Public License
018     * in this software distribution. If not, see <http://www.gnu.org/licenses/gpl-3.0.html/>.
019     */
020    
021    package uk.ac.roslin.ensembl.config;
022    
023    import java.util.HashMap;
024    import uk.ac.roslin.ensembl.model.core.CoordSystemType;
025    import uk.ac.roslin.ensembl.model.core.CoreObjectType;
026    
027    /**
028     *
029     * @author paterson
030     */
031    public class EnsemblCoordSystemType extends EnsemblType implements CoreObjectType, CoordSystemType {
032    
033    
034        public static EnsemblCoordSystemType contig;
035        public static EnsemblCoordSystemType supercontig;
036        public static EnsemblCoordSystemType clone;
037        public static EnsemblCoordSystemType chromosome;
038        public static EnsemblCoordSystemType scaffold;
039        public static EnsemblCoordSystemType plasmid;
040        public static EnsemblCoordSystemType plastid;
041        public static EnsemblCoordSystemType unknown;
042        public static EnsemblCoordSystemType lrg;
043    
044        public static String sequenceLevel = "sequence_level";
045        public static String defaultVersion = "default_version";
046    
047        private static HashMap<String,EnsemblCoordSystemType> types = EnsemblCoordSystemType.init();
048    
049        private EnsemblCoordSystemType(String type) {
050            label = type;
051        }
052    
053        private static HashMap<String,EnsemblCoordSystemType> init() {
054            HashMap<String,EnsemblCoordSystemType> out = new HashMap<String,EnsemblCoordSystemType>();
055            contig = new EnsemblCoordSystemType("contig");
056            out.put(contig.toString(),contig);
057            supercontig = new EnsemblCoordSystemType("supercontig");
058            out.put(supercontig.toString(),supercontig);
059            clone = new EnsemblCoordSystemType("clonedes");
060            out.put(clone.toString(),clone);
061            chromosome = new EnsemblCoordSystemType("chromosome");
062            out.put(chromosome.toString(),chromosome);
063            plasmid = new EnsemblCoordSystemType("plasmid");
064            out.put( plasmid.toString(), plasmid);
065            plastid = new EnsemblCoordSystemType("plastid");
066            out.put(plastid.toString(), plastid);
067            scaffold = new EnsemblCoordSystemType("scaffold");
068            out.put(scaffold.toString(), scaffold);
069            unknown = new EnsemblCoordSystemType("");
070            out.put(unknown.toString(),unknown);
071            lrg = new EnsemblCoordSystemType("lrg");
072            out.put(lrg.toString(),lrg);
073    
074            return out;
075        }
076    
077        public static EnsemblCoordSystemType getType(String name) {
078    
079            EnsemblCoordSystemType out = types.get(name);
080    
081            if (out == null) {
082                out = EnsemblCoordSystemType.unknown;
083            }
084    
085            return out;
086            
087        }
088        
089    
090            @Override
091            public String toString() {
092                return label;
093            }
094    
095        
096    
097    }