use crate::interface::alphabet::{Alphabet, AlphabetError};
use crate::interface::sequence::GenomeSequence;
pub trait SequenceStore<AlphabetType: Alphabet> {
type Handle;
type SequenceRef: GenomeSequence<AlphabetType, Self::SequenceRef> + ?Sized;
fn add<
Sequence: GenomeSequence<AlphabetType, Subsequence> + ?Sized,
Subsequence: GenomeSequence<AlphabetType, Subsequence> + ?Sized,
>(
&mut self,
s: &Sequence,
) -> Self::Handle;
fn add_from_iter_u8<IteratorType: IntoIterator<Item = u8>>(
&mut self,
iter: IteratorType,
) -> Result<Self::Handle, AlphabetError>;
fn add_from_slice_u8(&mut self, slice: &[u8]) -> Result<Self::Handle, AlphabetError> {
self.add_from_iter_u8(slice.iter().copied())
}
fn get(&self, handle: &Self::Handle) -> &Self::SequenceRef;
}
pub trait InverseMappingSequenceStore<AlphabetType: Alphabet>: SequenceStore<AlphabetType> {
fn map_sequence_ref_to_handle(&self, sequence_ref: &Self::SequenceRef) -> Self::Handle;
}
pub trait HandleWithLength {
fn len(&self) -> usize;
fn is_empty(&self) -> bool {
self.len() == 0
}
}
pub trait HandleWithSubsequence<RangeType> {
fn subsequence_handle(&self, range: RangeType) -> Self;
}