1 25 26 package org.objectweb.medor.eval.prefetch.lib; 27 28 import org.objectweb.jorm.mapper.rdb.lib.RdbIntermediaryTuple; 29 import org.objectweb.medor.api.MedorException; 30 import org.objectweb.medor.eval.prefetch.api.IntermediaryPrefetchBuffer; 31 import org.objectweb.medor.eval.prefetch.api.PrefetchBuffer; 32 import org.objectweb.medor.tuple.api.Tuple; 33 import org.objectweb.medor.tuple.api.TupleCollection; 34 35 38 public class IntermediaryPrefetchBufferImpl implements 39 IntermediaryPrefetchBuffer { 40 41 private PrefetchBuffer delegatePb; 42 private int[] associationTable; 43 44 public IntermediaryPrefetchBufferImpl(PrefetchBuffer delegatePb, int[] associationTable) { 45 this.delegatePb = delegatePb; 46 this.associationTable = associationTable; 47 } 48 49 public void setDelegatePrefetchBuffer(PrefetchBuffer pb) { 50 this.delegatePb = pb; 51 } 52 53 public PrefetchBuffer getDelegatePrefetchBuffer() { 54 return delegatePb; 55 } 56 57 public void setAssociationTable(int[] indexes) { 58 associationTable = indexes; 59 } 60 61 public int[] getAssociationTable() { 62 return associationTable; 63 } 64 65 public void addPrefetchTuple() throws MedorException { 67 delegatePb.addPrefetchTuple(); 68 } 69 70 public void setTupleCollection(TupleCollection tc) throws MedorException { 72 delegatePb.setTupleCollection(tc); 73 } 74 75 public void close() throws MedorException { 77 delegatePb.close(); 78 } 79 80 public boolean isClosed() { 82 return delegatePb.isClosed(); 83 } 84 85 90 public Tuple getTuple(Object index) throws MedorException { 91 Tuple delegatePbTuple = delegatePb.getTuple(index); 92 if(delegatePbTuple == null) 94 return null; 95 RdbIntermediaryTuple intermediaryTuple = new RdbIntermediaryTuple(associationTable, delegatePbTuple); 96 return intermediaryTuple; 97 } 98 99 public TupleCollection getTupleCollection(Object index) throws MedorException { 100 return delegatePb.getTupleCollection(index); 101 } 102 103 } 104 | Popular Tags |