1 21 22 package org.apache.derby.impl.store.access.conglomerate; 23 24 25 import org.apache.derby.iapi.services.io.ArrayInputStream; 26 27 import org.apache.derby.iapi.services.sanity.SanityManager; 28 29 import org.apache.derby.iapi.services.io.Storable; 30 import org.apache.derby.iapi.services.io.TypedFormat; 31 32 import org.apache.derby.iapi.error.StandardException; 33 34 import org.apache.derby.iapi.store.access.BinaryOrderable; 35 36 import java.io.Externalizable ; 37 import java.io.ObjectOutput ; 38 import java.io.ObjectInput ; 39 import java.io.IOException ; 40 41 47 48 class BinaryOrderableWrapper implements Storable 49 { 50 51 BinaryOrderable ref_object; 52 BinaryOrderable other_object; 53 int cmp_result; 54 55 56 BinaryOrderableWrapper() 57 { 58 } 59 60 61 71 protected void init ( 72 BinaryOrderable ref_object, 73 BinaryOrderable other_object) 74 { 75 this.ref_object = ref_object; 76 this.other_object = other_object; 77 } 78 79 80 88 public int getCmpResult() 89 { 90 return(this.cmp_result); 91 } 92 93 94 96 97 public int getTypeFormatId() { 98 if (SanityManager.DEBUG) 100 SanityManager.THROWASSERT("If someone calls this it is a problem."); 101 return(((TypedFormat)this.ref_object).getTypeFormatId()); 102 } 103 104 110 public boolean isNull() 111 { 112 if (SanityManager.DEBUG) 114 SanityManager.THROWASSERT("If someone calls this it is a problem."); 115 return(false); 116 } 117 118 125 public void restoreToNull() 126 { 127 if (SanityManager.DEBUG) 129 SanityManager.THROWASSERT("WORK TODO - code up null compare."); 130 131 return; 132 } 133 134 145 public void readExternal(ObjectInput in) 146 throws IOException , ClassNotFoundException 147 { 148 149 this.cmp_result = this.ref_object.binarycompare(in, this.other_object); 151 152 if (SanityManager.DEBUG) 153 SanityManager.THROWASSERT("WORK TODO - code up readExternal."); 154 } 155 public void readExternalFromArray(ArrayInputStream in) 156 throws IOException , ClassNotFoundException 157 { 158 159 this.cmp_result = this.ref_object.binarycompare(in, this.other_object); 161 162 if (SanityManager.DEBUG) 163 SanityManager.THROWASSERT("WORK TODO - code up readExternal."); 164 } 165 166 177 public void writeExternal(ObjectOutput out) 178 throws IOException 179 { 180 if (SanityManager.DEBUG) 181 SanityManager.THROWASSERT("Write should never be called."); 182 return; 183 } 184 } 185 | Popular Tags |