1 23 package org.objectweb.medor.tuple.lib; 24 25 import org.objectweb.medor.tuple.api.TupleCollection; 26 import org.objectweb.medor.tuple.api.Tuple; 27 import org.objectweb.medor.api.TupleStructure; 28 import org.objectweb.medor.clone.lib.BasicCloneable; 29 import org.objectweb.medor.api.MedorException; 30 31 import java.util.Map ; 32 33 38 public class EmptyTupleCollection 39 extends BasicCloneable 40 implements TupleCollection { 41 42 private TupleStructure ts; 43 private boolean closed; 44 45 public EmptyTupleCollection() { 46 } 47 48 public EmptyTupleCollection(TupleStructure _ts) { 49 ts = _ts; 50 closed =false; 51 } 52 53 public Object clone(Object clone, 54 Map obj2clone) throws CloneNotSupportedException { 55 clone = super.clone(clone, obj2clone); 56 ((EmptyTupleCollection) clone).closed = closed; 57 ((EmptyTupleCollection) clone).ts = (TupleStructure) getClone(ts, obj2clone); 58 return clone; 59 } 60 61 public TupleStructure getMetaData() throws MedorException { 62 if (closed) { 63 throw new MedorException("Impossible to use a closed TupleCollection"); 64 } 65 return ts; 66 } 67 68 public boolean isLast() throws MedorException { 69 if (closed) { 70 throw new MedorException("Impossible to use a closed TupleCollection"); 71 } 72 return false; 73 } 74 75 public boolean next() throws MedorException { 76 if (closed) { 77 throw new MedorException("Impossible to use a closed TupleCollection"); 78 } 79 return false; 80 } 81 82 public void first() throws MedorException { 83 throw new MedorException("Empty result"); 84 } 85 86 public int getRow() throws MedorException { 87 throw new MedorException("Empty result"); 88 } 89 90 public Tuple getTuple() throws MedorException { 91 throw new MedorException("Empty result"); 92 } 93 94 public Tuple getTuple(int row) throws MedorException { 95 throw new MedorException("Empty result"); 96 } 97 98 public boolean row(int row) throws MedorException { 99 throw new MedorException("Empty result"); 100 } 101 102 public boolean isEmpty() throws MedorException { 103 if (closed) { 104 throw new MedorException("Impossible to use a closed TupleCollection"); 105 } 106 return true; 107 } 108 109 public void close() throws MedorException { 110 closed = true; 111 } 112 } 113 | Popular Tags |