KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > store > access > conglomerate > RowPosition


1 /*
2
3    Derby - Class org.apache.derby.impl.store.access.conglomerate.RowPosition
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.store.access.conglomerate;
23
24 import org.apache.derby.iapi.services.sanity.SanityManager;
25
26 import org.apache.derby.iapi.store.raw.ContainerHandle;
27 import org.apache.derby.iapi.store.raw.Page;
28 import org.apache.derby.iapi.store.raw.RecordHandle;
29
30 /**
31
32 Just an easy way to pass information back and forth about current position of
33 a row in a table.
34
35 **/

36
37 public class RowPosition
38 {
39     /**************************************************************************
40      * Fields of the class
41      **************************************************************************
42      */

43     public Page current_page;
44     public RecordHandle current_rh;
45     public int current_slot;
46     public boolean current_rh_qualified;
47     public long current_pageno;
48
49     /**************************************************************************
50      * Constructors for This class:
51      **************************************************************************
52      */

53     public RowPosition()
54     {
55     }
56
57     /**************************************************************************
58      * Private/Protected methods of This class:
59      **************************************************************************
60      */

61
62     /**************************************************************************
63      * Public Methods of This class:
64      **************************************************************************
65      */

66
67     public void init()
68     {
69         current_page = null;
70         current_rh = null;
71         current_slot = Page.INVALID_SLOT_NUMBER;
72         current_rh_qualified = false;
73         current_pageno = ContainerHandle.INVALID_PAGE_NUMBER;
74     }
75
76     public final void positionAtNextSlot()
77     {
78         current_slot++;
79         current_rh = null;
80     }
81
82     public final void positionAtPrevSlot()
83     {
84         current_slot--;
85         current_rh = null;
86     }
87
88     public void unlatch()
89     {
90         if (current_page != null)
91         {
92             current_page.unlatch();
93             current_page = null;
94         }
95         current_slot = Page.INVALID_SLOT_NUMBER;
96     }
97
98     public String JavaDoc toString()
99     {
100         String JavaDoc ret_string = null;
101
102         if (SanityManager.DEBUG)
103         {
104             ret_string =
105                 ";current_slot=" + current_slot +
106                 ";current_rh=" + current_rh +
107                 ";current_pageno=" + current_pageno +
108                 ";current_page=" +
109                     (current_page == null ?
110                          "null" : String.valueOf(current_page.getPageNumber()));
111
112                 // ";current_page=" + current_page;
113
}
114
115         return(ret_string);
116     }
117
118     /**************************************************************************
119      * Public Methods of XXXX class:
120      **************************************************************************
121      */

122 }
123
Popular Tags