1 17 package org.apache.ldap.server.db; 18 19 20 import javax.naming.directory.Attributes ; 21 import java.math.BigInteger ; 22 23 24 31 public class IndexRecord 32 { 33 34 private final Tuple tuple = new Tuple(); 35 36 private Attributes entry = null; 37 38 39 46 public void setTuple( Tuple tuple, Attributes entry ) 47 { 48 this.tuple.setKey( tuple.getKey() ); 49 this.tuple.setValue( tuple.getValue() ); 50 this.entry = entry; 51 } 52 53 54 61 public void setSwapped( Tuple tuple, Attributes entry ) 62 { 63 this.tuple.setKey( tuple.getValue() ); 64 this.tuple.setValue( tuple.getKey() ); 65 this.entry = entry; 66 } 67 68 69 74 public BigInteger getEntryId() 75 { 76 return ( BigInteger ) tuple.getValue(); 77 } 78 79 80 85 public Object getIndexKey() 86 { 87 return tuple.getKey(); 88 } 89 90 91 96 public void setEntryId( BigInteger id ) 97 { 98 tuple.setValue( id ); 99 } 100 101 102 107 public void setIndexKey( Object key ) 108 { 109 tuple.setKey( key ); 110 } 111 112 113 119 public Attributes getAttributes() 120 { 121 return entry; 122 } 123 124 125 130 public void setAttributes( Attributes entry ) 131 { 132 this.entry = entry; 133 } 134 135 136 139 public void clear() 140 { 141 entry = null; 142 tuple.setKey( null ); 143 tuple.setValue( null ); 144 } 145 146 147 153 public void copy( IndexRecord record ) 154 { 155 entry = record.getAttributes(); 156 tuple.setKey( record.getIndexKey() ); 157 tuple.setValue( record.getEntryId() ); 158 } 159 } 160 | Popular Tags |