org.biojava3.core.sequence.template
Class AbstractCompoundSet<C extends Compound>

java.lang.Object
  extended by org.biojava3.core.sequence.template.AbstractCompoundSet<C>
Type Parameters:
C - The compound this set will contain
All Implemented Interfaces:
CompoundSet<C>
Direct Known Subclasses:
AbstractNucleotideCompoundSet

public abstract class AbstractCompoundSet<C extends Compound>
extends Object
implements CompoundSet<C>

Author:
Andy Yates

Constructor Summary
AbstractCompoundSet()
           
 
Method Summary
protected  void addCompound(C compound)
           
protected  void addCompound(C compound, C lowerCasedCompound, C... equivalents)
           
protected  void addCompound(C compound, C lowerCasedCompound, Iterable<C> equivalents)
           
protected  void addEquivalent(C compound, C equivalent)
           
 boolean compoundsEqual(C compoundOne, C compoundTwo)
           
 boolean compoundsEquivalent(C compoundOne, C compoundTwo)
           
 boolean equals(Object o)
           
 List<C> getAllCompounds()
           
 C getCompoundForString(String string)
          Return null if not recognised.
 Set<C> getEquivalentCompounds(C compound)
           
 int getMaxSingleCompoundStringLength()
          Returns the maximum size of a compound String this set holds
 String getStringForCompound(C compound)
           
 boolean hasCompound(C compound)
           
 int hashCode()
           
 boolean isComplementable()
           
 boolean isCompoundStringLengthEqual()
          Returns true if all String representations of Compounds are of the same length.
 void verifySequence(Sequence<C> sequence)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCompoundSet

public AbstractCompoundSet()
Method Detail

addCompound

protected void addCompound(C compound,
                           C lowerCasedCompound,
                           Iterable<C> equivalents)

addCompound

protected void addCompound(C compound,
                           C lowerCasedCompound,
                           C... equivalents)

addEquivalent

protected void addEquivalent(C compound,
                             C equivalent)

addCompound

protected void addCompound(C compound)

getStringForCompound

public String getStringForCompound(C compound)
Specified by:
getStringForCompound in interface CompoundSet<C extends Compound>

getCompoundForString

public C getCompoundForString(String string)
Description copied from interface: CompoundSet
Return null if not recognised. Throw IllegalArgumentException if string is longer than maximum allowed by CompoundSet.getStringForCompound(Compound).

Specified by:
getCompoundForString in interface CompoundSet<C extends Compound>

getMaxSingleCompoundStringLength

public int getMaxSingleCompoundStringLength()
Description copied from interface: CompoundSet
Returns the maximum size of a compound String this set holds

Specified by:
getMaxSingleCompoundStringLength in interface CompoundSet<C extends Compound>

isCompoundStringLengthEqual

public boolean isCompoundStringLengthEqual()
Description copied from interface: CompoundSet
Returns true if all String representations of Compounds are of the same length.

Specified by:
isCompoundStringLengthEqual in interface CompoundSet<C extends Compound>

hasCompound

public boolean hasCompound(C compound)
Specified by:
hasCompound in interface CompoundSet<C extends Compound>

compoundsEquivalent

public boolean compoundsEquivalent(C compoundOne,
                                   C compoundTwo)
Specified by:
compoundsEquivalent in interface CompoundSet<C extends Compound>

getEquivalentCompounds

public Set<C> getEquivalentCompounds(C compound)
Specified by:
getEquivalentCompounds in interface CompoundSet<C extends Compound>

compoundsEqual

public boolean compoundsEqual(C compoundOne,
                              C compoundTwo)

verifySequence

public void verifySequence(Sequence<C> sequence)
                    throws CompoundNotFoundError
Specified by:
verifySequence in interface CompoundSet<C extends Compound>
Throws:
CompoundNotFoundError

getAllCompounds

public List<C> getAllCompounds()
Specified by:
getAllCompounds in interface CompoundSet<C extends Compound>

isComplementable

public boolean isComplementable()
Specified by:
isComplementable in interface CompoundSet<C extends Compound>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object