1 package jp.naist.se.stigmata.result;
\r
7 import java.util.Iterator;
\r
9 import jp.naist.se.stigmata.BirthmarkContext;
\r
10 import jp.naist.se.stigmata.BirthmarkEnvironment;
\r
11 import jp.naist.se.stigmata.BirthmarkSet;
\r
12 import jp.naist.se.stigmata.ExtractionResultSet;
\r
13 import jp.naist.se.stigmata.ExtractionTarget;
\r
16 * Abstract class for ExtractionResultSet.
\r
18 * @author Haruaki Tamada
\r
19 * @version $Revision$ $Date$
\r
21 public abstract class AbstractExtractionResultSet implements ExtractionResultSet{
\r
22 private BirthmarkContext context;
\r
23 private boolean tableType = true;
\r
28 public AbstractExtractionResultSet(BirthmarkContext context){
\r
29 this(context, true);
\r
35 public AbstractExtractionResultSet(BirthmarkContext context, boolean tableType){
\r
36 this.context = context;
\r
39 public BirthmarkEnvironment getEnvironment(){
\r
40 return context.getEnvironment();
\r
43 public BirthmarkContext getContext(){
\r
47 public abstract void addBirthmarkSet(ExtractionTarget target, BirthmarkSet set);
\r
49 public abstract void removeBirthmarkSet(ExtractionTarget target, BirthmarkSet set);
\r
51 public abstract void removeAllBirthmarkSets(ExtractionTarget target);
\r
53 public abstract int getBirthmarkSetSize(ExtractionTarget target);
\r
55 public abstract Iterator<BirthmarkSet> birthmarkSets(ExtractionTarget target);
\r
57 public int getBirthmarkSetSize(){
\r
58 return getBirthmarkSetSize(ExtractionTarget.TARGET_BOTH);
\r
61 public Iterator<BirthmarkSet> iterator(){
\r
62 return birthmarkSets(ExtractionTarget.TARGET_BOTH);
\r
65 public BirthmarkSet getBirthmarkSet(int index){
\r
66 return getBirthmarkSet(ExtractionTarget.TARGET_BOTH, index);
\r
69 public BirthmarkSet getBirthmarkSet(String name){
\r
70 return getBirthmarkSet(ExtractionTarget.TARGET_BOTH, name);
\r
73 public BirthmarkSet[] getBirthmarkSets(){
\r
74 return getBirthmarkSets(ExtractionTarget.TARGET_BOTH);
\r
77 public void removeBirthmarkSet(BirthmarkSet bs){
\r
78 removeBirthmarkSet(ExtractionTarget.TARGET_BOTH, bs);
\r
81 public void removeAllBirthmarkSets(){
\r
82 removeAllBirthmarkSets(ExtractionTarget.TARGET_BOTH);
\r
85 public String[] getBirthmarkTypes(){
\r
86 return context.getExtractionTypes();
\r
89 public BirthmarkSet getBirthmarkSet(ExtractionTarget target, int index){
\r
90 int currentIndex = 0;
\r
91 for(Iterator<BirthmarkSet> i = birthmarkSets(target); i.hasNext(); ){
\r
92 if(currentIndex == index){
\r
101 public BirthmarkSet getBirthmarkSet(ExtractionTarget target, String setname){
\r
102 for(Iterator<BirthmarkSet> i = birthmarkSets(target); i.hasNext(); ){
\r
103 BirthmarkSet bs = i.next();
\r
104 if(bs.getName().equals(setname)){
\r
111 public synchronized BirthmarkSet[] getBirthmarkSets(ExtractionTarget target){
\r
112 return AbstractComparisonResultSet.<BirthmarkSet>getArrays(birthmarkSets(target));
\r
115 public void setBirthmarkSets(ExtractionTarget target, BirthmarkSet[] sets){
\r
116 removeAllBirthmarkSets(target);
\r
117 for(int i = 0; i < sets.length; i++){
\r
118 addBirthmarkSet(target, sets[i]);
\r
122 public boolean isTableType(){
\r
126 public void setTableType(boolean flag){
\r
127 this.tableType = flag;
\r