001: /*
002:
003: Derby - Class org.apache.derby.impl.store.access.conglomerate.RowPosition
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.impl.store.access.conglomerate;
023:
024: import org.apache.derby.iapi.services.sanity.SanityManager;
025:
026: import org.apache.derby.iapi.store.raw.ContainerHandle;
027: import org.apache.derby.iapi.store.raw.Page;
028: import org.apache.derby.iapi.store.raw.RecordHandle;
029:
030: /**
031:
032: Just an easy way to pass information back and forth about current position of
033: a row in a table.
034:
035: **/
036:
037: public class RowPosition {
038: /**************************************************************************
039: * Fields of the class
040: **************************************************************************
041: */
042: public Page current_page;
043: public RecordHandle current_rh;
044: public int current_slot;
045: public boolean current_rh_qualified;
046: public long current_pageno;
047:
048: /**************************************************************************
049: * Constructors for This class:
050: **************************************************************************
051: */
052: public RowPosition() {
053: }
054:
055: /**************************************************************************
056: * Private/Protected methods of This class:
057: **************************************************************************
058: */
059:
060: /**************************************************************************
061: * Public Methods of This class:
062: **************************************************************************
063: */
064:
065: public void init() {
066: current_page = null;
067: current_rh = null;
068: current_slot = Page.INVALID_SLOT_NUMBER;
069: current_rh_qualified = false;
070: current_pageno = ContainerHandle.INVALID_PAGE_NUMBER;
071: }
072:
073: public final void positionAtNextSlot() {
074: current_slot++;
075: current_rh = null;
076: }
077:
078: public final void positionAtPrevSlot() {
079: current_slot--;
080: current_rh = null;
081: }
082:
083: public void unlatch() {
084: if (current_page != null) {
085: current_page.unlatch();
086: current_page = null;
087: }
088: current_slot = Page.INVALID_SLOT_NUMBER;
089: }
090:
091: public String toString() {
092: String ret_string = null;
093:
094: if (SanityManager.DEBUG) {
095: ret_string = ";current_slot="
096: + current_slot
097: + ";current_rh="
098: + current_rh
099: + ";current_pageno="
100: + current_pageno
101: + ";current_page="
102: + (current_page == null ? "null" : String
103: .valueOf(current_page.getPageNumber()));
104:
105: // ";current_page=" + current_page;
106: }
107:
108: return (ret_string);
109: }
110:
111: /**************************************************************************
112: * Public Methods of XXXX class:
113: **************************************************************************
114: */
115: }
|