1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.xdbm;
21
22
23
24
25
26
27
28
29
30 public class ForwardIndexEntry<V,O> implements IndexEntry<V,O>
31 {
32
33 private final Tuple<V,Long> tuple = new Tuple<V,Long>();
34
35
36 private O obj;
37
38
39
40
41
42
43
44
45
46
47 public void setTuple( Tuple<V,Long> tuple, O entry )
48 {
49 this.tuple.setKey( tuple.getKey() );
50 this.tuple.setValue( tuple.getValue() );
51 this.obj = entry;
52 }
53
54
55 public Long getId()
56 {
57 return tuple.getValue();
58 }
59
60
61 public V getValue()
62 {
63 return tuple.getKey();
64 }
65
66
67 public void setId( Long id )
68 {
69 tuple.setValue( id );
70 }
71
72
73 public void setValue( V value )
74 {
75 tuple.setKey( value );
76 }
77
78
79 public O getObject()
80 {
81 if ( obj == null )
82 {
83 return null;
84 }
85
86 return obj;
87 }
88
89
90 public void setObject( O obj )
91 {
92 this.obj = obj;
93 }
94
95
96 public Tuple getTuple()
97 {
98 return tuple;
99 }
100
101
102 public void clear()
103 {
104 obj = null;
105 tuple.setKey( null );
106 tuple.setValue( null );
107 }
108
109
110 public void copy( IndexEntry<V, O> entry )
111 {
112 this.obj = entry.getObject();
113 tuple.setKey( entry.getValue() );
114 tuple.setValue( entry.getId() );
115 }
116
117
118 public String toString()
119 {
120 StringBuilder buf = new StringBuilder();
121 buf.append( "ForwardIndexEntry[ " );
122 buf.append( tuple.getKey() );
123 buf.append( ", " );
124 buf.append( tuple.getValue() );
125 buf.append( " ]" );
126 return buf.toString();
127 }
128 }