001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021 022package org.biojava.bio.seq.io; 023 024import org.biojava.bio.BioException; 025import org.biojava.bio.seq.Feature; 026import org.biojava.bio.seq.Sequence; 027import org.biojava.bio.symbol.Alphabet; 028import org.biojava.bio.symbol.IllegalAlphabetException; 029import org.biojava.bio.symbol.Symbol; 030 031/** 032 * Base-class for builders that pass filtered events onto another builder. 033 * 034 * @author Matthew Pocock 035 * @since 1.1 036 * @see org.biojavax.bio.seq.io.RichSeqIOAdapter 037 */ 038public class SequenceBuilderFilter implements SequenceBuilder { 039 /** 040 * Delegate that will recieve all of the forwarded event. 041 */ 042 private SequenceBuilder delegate; 043 044 /** 045 * Create a new SeqIOFilter that will forward events on to another listener. 046 * 047 * @param delegate the SequenceBuilder to wrap 048 */ 049 public SequenceBuilderFilter(SequenceBuilder delegate) { 050 this.delegate = delegate; 051 } 052 053 /** 054 * Retrieve the delegate that is wrapped. 055 * 056 * @return the SequenceBuilder delegate 057 */ 058 public SequenceBuilder getDelegate() { 059 return delegate; 060 } 061 062 public void startSequence() throws ParseException { 063 delegate.startSequence(); 064 } 065 066 public void endSequence() throws ParseException { 067 delegate.endSequence(); 068 } 069 070 public void setName(String name) throws ParseException { 071 delegate.setName(name); 072 } 073 074 public void setURI(String uri) throws ParseException { 075 delegate.setURI(uri); 076 } 077 078 public void addSymbols(Alphabet alpha, Symbol[] syms, int start, int length) 079 throws IllegalAlphabetException { 080 delegate.addSymbols(alpha, syms, start, length); 081 } 082 083 public void addSequenceProperty(Object key, Object value) throws ParseException { 084 delegate.addSequenceProperty(key, value); 085 } 086 087 public void startFeature(Feature.Template templ) throws ParseException { 088 delegate.startFeature(templ); 089 } 090 091 public void endFeature() throws ParseException { 092 delegate.endFeature(); 093 } 094 095 public void addFeatureProperty(Object key, Object value) throws ParseException { 096 delegate.addFeatureProperty(key, value); 097 } 098 099 public Sequence makeSequence() throws BioException { 100 return delegate.makeSequence(); 101 } 102}