01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.sail.nativerdf.btree;
07:
08: /**
09: * A RecordComparator that compares values with eachother by comparing all
10: * of their bytes.
11: *
12: * @author Arjohn Kampman
13: */
14: public class DefaultRecordComparator implements RecordComparator {
15:
16: // implements RecordComparator.compareBTreeValues()
17: public int compareBTreeValues(byte[] key, byte[] data, int offset,
18: int length) {
19: int result = 0;
20: for (int i = 0; result == 0 && i < length; i++) {
21: result = (key[i] & 0xff) - (data[offset + i] & 0xff);
22: }
23: return result;
24: }
25: }
|