001package org.biojava.bio.program.formats;
002
003import org.biojava.bio.AnnotationType;
004import org.biojava.bio.CardinalityConstraint;
005import org.biojava.bio.PropertyConstraint;
006import org.biojava.bio.program.tagvalue.LineSplitParser;
007import org.biojava.bio.program.tagvalue.ParserListener;
008import org.biojava.bio.program.tagvalue.TagValueListener;
009import org.biojava.bio.symbol.Location;
010import org.biojava.utils.lsid.LifeScienceIdentifier;
011
012public class Embl
013implements Format {
014  private static final AnnotationType ANNO_TYPE;
015  private static final LineSplitParser PARSER;
016  private static final LifeScienceIdentifier LSID;
017
018  static {
019    LSID = LifeScienceIdentifier.valueOf("open-bio.org", "format", "embl");
020
021    Location NONE = CardinalityConstraint.NONE;
022    Location ANY = CardinalityConstraint.ANY;
023    Location ONE = CardinalityConstraint.ONE;
024    Location ONE_OR_MORE = CardinalityConstraint.ONE_OR_MORE;
025
026    PARSER = new LineSplitParser(LineSplitParser.EMBL);
027
028    PropertyConstraint c_string = new PropertyConstraint.ByClass(String.class);
029
030    ANNO_TYPE = new AnnotationType.Impl();
031    ANNO_TYPE.setDefaultConstraints(PropertyConstraint.NONE, NONE);
032    ANNO_TYPE.setConstraints("ID", c_string, ONE);
033    ANNO_TYPE.setConstraints("AC", c_string, ONE_OR_MORE);
034    ANNO_TYPE.setConstraints("SV", c_string, ONE);
035    ANNO_TYPE.setConstraints("DT", c_string, ANY);
036  }
037
038  public LifeScienceIdentifier getLSID() {
039    return LSID;
040  }
041
042  public AnnotationType getType() {
043    return ANNO_TYPE;
044  }
045
046  public ParserListener getParserListener(TagValueListener listener) {
047    return new ParserListener(PARSER, listener);
048  }
049}