/** Is (key, value) of record1 equal to (key,value) of record2 */ public static boolean equals(Record record1, Record record2) { int x = compareByKeyValue(record1, record2) ; return x == 0 ; }
@Override public boolean equals(Object other) { if ( this == other ) return true ; if ( ! ( other instanceof Record ) ) return false ; Record r = (Record)other ; return compareByKeyValue(this, r) == 0 ; }
private static void contains(BPTreeRecords bpr, int... values) { assertEquals(values.length, bpr.getCount()) ; for ( int i = 1 ; i < values.length ; i++ ) assertTrue(Record.compareByKeyValue(RecordLib.intToRecord(values[i]), bpr.getRecordBuffer().get(i)) == 0) ; }
@Override Record internalInsert(AccessPath path, Record record) { // Delay promotion until we know change will happen. int i = rBuff.find(record) ; Record r2 = null ; if ( i < 0 ) { i = decodeIndex(i) ; if ( rBuff.size() >= rBuff.maxSize() ) throw new StorageException("RecordBlock.put overflow") ; promotePage(path, this) ; rBuff.add(i, record) ; } else { r2 = rBuff.get(i) ; if ( Record.compareByKeyValue(record, r2) != 0 ) { // Replace : return old promotePage(path, this) ; rBuff.set(i, record) ; } else // No promotion, no write return r2 ; } write() ; return r2 ; }