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, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.record;
020
021import org.apache.hadoop.classification.InterfaceAudience;
022import org.apache.hadoop.classification.InterfaceStability;
023import org.apache.hadoop.io.WritableComparable;
024import org.apache.hadoop.io.WritableComparator;
025
026/**
027 * A raw record comparator base class
028 * 
029 * @deprecated Replaced by <a href="https://hadoop.apache.org/avro/">Avro</a>.
030 */
031@Deprecated
032@InterfaceAudience.Public
033@InterfaceStability.Stable
034public abstract class RecordComparator extends WritableComparator {
035  
036  /**
037   * Construct a raw {@link Record} comparison implementation. */
038  protected RecordComparator(Class<? extends WritableComparable> recordClass) {
039    super(recordClass);
040  }
041  
042  // inheric JavaDoc
043  @Override
044  public abstract int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2);
045  
046  /**
047   * Register an optimized comparator for a {@link Record} implementation.
048   *
049   * @param c record classs for which a raw comparator is provided
050   * @param comparator Raw comparator instance for class c 
051   */
052  public static synchronized void define(Class c, RecordComparator comparator) {
053    WritableComparator.define(c, comparator);
054  }
055}