001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.mavibot.btree; 021 022 023import java.util.Arrays; 024 025 026/** 027 * A class to hold name, revision, and copied page offsets of a B-Tree. 028 * 029 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 030 */ 031public class RevisionOffset 032{ 033 /** the revision number */ 034 private long revision; 035 036 /** offsets of copied pages */ 037 private long[] offsets; 038 039 040 /** 041 * Creates a new instance of RevisionOffset. 042 * 043 * @param revision the revision number 044 * @param offsets array of copied page offsets 045 */ 046 public RevisionOffset( long revision, long[] offsets ) 047 { 048 this.revision = revision; 049 this.offsets = offsets; 050 } 051 052 053 public long getRevision() 054 { 055 return revision; 056 } 057 058 059 /* no qualifier */void setRevision( long revision ) 060 { 061 this.revision = revision; 062 } 063 064 065 public long[] getOffsets() 066 { 067 return offsets; 068 } 069 070 071 /* no qualifier */void setOffsets( long[] offsets ) 072 { 073 this.offsets = offsets; 074 } 075 076 077 @Override 078 public int hashCode() 079 { 080 final int prime = 31; 081 int result = 1; 082 result = prime * result + ( int ) ( revision ^ ( revision >>> 32 ) ); 083 return result; 084 } 085 086 087 @Override 088 public boolean equals( Object obj ) 089 { 090 if ( this == obj ) 091 { 092 return true; 093 } 094 095 if ( obj == null ) 096 { 097 return false; 098 } 099 100 RevisionOffset other = ( RevisionOffset ) obj; 101 102 if ( revision != other.revision ) 103 { 104 return false; 105 } 106 107 return true; 108 } 109 110 111 @Override 112 public String toString() 113 { 114 return "RevisionOffset [revision=" + revision + ", offsets=" + Arrays.toString( offsets ) + "]"; 115 } 116 117}