1 2 12 package com.versant.core.common; 13 14 import com.versant.core.util.OIDObjectOutput; 15 import com.versant.core.util.OIDObjectInput; 16 17 import java.io.IOException ; 18 19 23 public class UnorderedCollectionDiff extends CollectionDiff { 24 25 public UnorderedCollectionDiff() { 26 } 27 28 public UnorderedCollectionDiff(VersantFieldMetaData fmd) { 29 super(fmd); 30 } 31 32 35 public Object [] deletedValues; 36 37 protected Object clone() throws CloneNotSupportedException { 38 UnorderedCollectionDiff cloned = null; 39 try { 40 cloned = (UnorderedCollectionDiff)super.clone(); 41 cloned.deletedValues = new Object [deletedValues.length]; 42 System.arraycopy(deletedValues, 0, cloned.deletedValues, 0, 43 deletedValues.length); 44 return cloned; 45 } catch (CloneNotSupportedException e) { 46 e.printStackTrace(); 47 } 48 return cloned; 49 } 50 51 public String toString() { 52 return "<UnorderedCollectionDiff: status = " + status + ": amount added =" 53 + (insertedValues != null ? insertedValues.length : -1) 54 + " deleted amount = " 55 + (deletedValues != null ? deletedValues.length : -1) + ">"; 56 } 57 58 public void writeExternal(OIDObjectOutput out) throws IOException { 59 super.writeExternal(out); 60 write(out, fmd.getElementTypeCode(), fmd.isElementTypePC(), 61 deletedValues); 62 } 63 64 public void readExternal(OIDObjectInput in) throws IOException , 65 ClassNotFoundException { 66 super.readExternal(in); 67 deletedValues = read(in, fmd.getElementTypeCode(), 68 fmd.isElementTypePC()); 69 } 70 71 public void dump() { 72 if (Debug.DEBUG) { 73 Debug.OUT.println("ToBeAdded"); 74 } 75 if (insertedValues != null) { 76 for (int i = 0; i < insertedValues.length; i++) { 77 if (Debug.DEBUG) { 78 Debug.OUT.println("inserted = " + insertedValues[i]); 79 } 80 } 81 } 82 83 if (Debug.DEBUG) { 84 Debug.OUT.println("ToBeDeleted"); 85 } 86 if (deletedValues != null) { 87 for (int i = 0; i < deletedValues.length; i++) { 88 if (Debug.DEBUG) { 89 Debug.OUT.println("deleted = " + deletedValues[i]); 90 } 91 } 92 } 93 } 94 95 } 96 | Popular Tags |