6b00ddbbaaeb62f11db68f8ae1e4db8dc7f8d8aa
[jalview.git] / src / jalview / io / packed / SimpleDataProvider.java
1 package jalview.io.packed;
2
3 import jalview.io.FileParse;
4
5 /**
6  * minimal implementation of the DataProvider interface.
7  * Allows a FileParse datasource to be specified as one of the DataProvider.JvDataType content types, with or without some other associated object as external reference.
8  */
9 public class SimpleDataProvider implements DataProvider
10 {
11   DataProvider.JvDataType jvtype;
12
13   FileParse source;
14
15   Object assocseq;
16
17   /**
18    * create a SimpleDataProvider
19    * @param type - contents of resource accessible via fp
20    * @param fp - datasource
21    * @param assoc - external object that fp's content should be associated with (may be null)
22    */
23   public SimpleDataProvider(DataProvider.JvDataType type, FileParse fp,
24           Object assoc)
25   {
26     jvtype = type;
27     source = fp;
28     assocseq = assoc;
29   }
30
31   @Override
32   public FileParse getDataSource()
33   {
34     return source;
35   }
36
37   @Override
38   public Object getSequenceTarget()
39   {
40     return assocseq;
41   }
42
43   @Override
44   public DataProvider.JvDataType getType()
45   {
46     return jvtype;
47   }
48
49 }