1 4 package com.tc.objectserver.core.api; 5 6 import com.tc.exception.ImplementMe; 7 import com.tc.object.dna.api.DNACursor; 8 import com.tc.object.dna.api.LiteralAction; 9 import com.tc.object.dna.api.LogicalAction; 10 import com.tc.object.dna.api.PhysicalAction; 11 import com.tc.object.dna.impl.DNAEncoding; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 19 public class TestDNACursor implements DNACursor { 20 21 private List actions = new ArrayList (); 22 private int current = -1; 23 24 public void addPhysicalAction(String addFieldName, Object addObj) { 25 actions.add(new PhysicalAction(addFieldName, addObj, true)); 26 } 27 28 public void addPhysicalAction(String addFieldName, Object addObj, boolean isref) { 29 actions.add(new PhysicalAction(addFieldName, addObj, isref)); 30 } 31 32 public void addLogicalAction(int method, Object params[]) { 33 actions.add(new LogicalAction(method, params)); 34 } 35 36 public void addArrayAction(Object [] objects) { 37 actions.add(new PhysicalAction(objects)); 38 } 39 40 public void addLiteralAction(String field, Object value) { 41 actions.add(new LiteralAction(value)); 43 } 44 45 public boolean next() { 46 return actions.size() > ++current; 47 } 48 49 public LogicalAction getLogicalAction() { 50 return (LogicalAction) actions.get(current); 51 } 52 53 public Object getAction() { 54 return actions.get(current); 55 } 56 57 public PhysicalAction getPhysicalAction() { 58 return (PhysicalAction) actions.get(current); 59 } 60 61 public boolean next(DNAEncoding encoding) { 62 throw new ImplementMe(); 63 } 64 65 public int getActionCount() { 66 return actions.size(); 67 } 68 69 public void reset() throws UnsupportedOperationException { 70 current = -1; 71 } 72 73 } | Popular Tags |