|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| LongRecordLocation.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/**
|
|
| 2 |
*
|
|
| 3 |
* Copyright 2004 Hiram Chirino
|
|
| 4 |
*
|
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
| 7 |
* You may obtain a copy of the License at
|
|
| 8 |
*
|
|
| 9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
| 10 |
*
|
|
| 11 |
* Unless required by applicable law or agreed to in writing, software
|
|
| 12 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
| 13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
| 14 |
* See the License for the specific language governing permissions and
|
|
| 15 |
* limitations under the License.
|
|
| 16 |
*
|
|
| 17 |
**/
|
|
| 18 |
package org.activeio.journal.howl;
|
|
| 19 |
|
|
| 20 |
import org.activeio.journal.RecordLocation;
|
|
| 21 |
|
|
| 22 |
/**
|
|
| 23 |
* Provides a RecordLocation implementation for the long based
|
|
| 24 |
* location pointers that HOWL uses.
|
|
| 25 |
*
|
|
| 26 |
* @version $Revision: 1.1 $
|
|
| 27 |
*/
|
|
| 28 |
public class LongRecordLocation implements RecordLocation { |
|
| 29 |
|
|
| 30 |
final private long location; |
|
| 31 |
|
|
| 32 | 0 |
public LongRecordLocation(long l) { |
| 33 | 0 |
this.location = l;
|
| 34 |
} |
|
| 35 |
|
|
| 36 |
/**
|
|
| 37 |
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
|
| 38 |
*/
|
|
| 39 | 0 |
public int compareTo(Object o) { |
| 40 | 0 |
return (int) (location - ((LongRecordLocation) o).location); |
| 41 |
} |
|
| 42 |
|
|
| 43 |
/**
|
|
| 44 |
* @return the original long location provided by HOWL
|
|
| 45 |
*/
|
|
| 46 | 0 |
public long getLongLocation() { |
| 47 | 0 |
return location;
|
| 48 |
} |
|
| 49 |
|
|
| 50 |
/**
|
|
| 51 |
* @see java.lang.Object#hashCode()
|
|
| 52 |
*/
|
|
| 53 | 0 |
public int hashCode() { |
| 54 | 0 |
int lowPart = (int) (0xFFFFFFFF & location); |
| 55 | 0 |
int highPart = (int) (0xFFFFFFFF & (location >> 4)); |
| 56 | 0 |
return lowPart ^ highPart;
|
| 57 |
} |
|
| 58 |
|
|
| 59 |
/**
|
|
| 60 |
* @see java.lang.Object#equals(java.lang.Object)
|
|
| 61 |
*/
|
|
| 62 | 0 |
public boolean equals(Object o) { |
| 63 | 0 |
if (o == null || o.getClass() != LongRecordLocation.class) |
| 64 | 0 |
return false; |
| 65 | 0 |
return ((LongRecordLocation) o).location == location;
|
| 66 |
} |
|
| 67 |
|
|
| 68 |
/**
|
|
| 69 |
* @see java.lang.Object#toString()
|
|
| 70 |
*/
|
|
| 71 | 0 |
public String toString() {
|
| 72 | 0 |
return "0x" + Long.toHexString(location); |
| 73 |
} |
|
| 74 |
} |
|
||||||||||