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.meta;
020
021import java.io.IOException;
022
023import org.apache.hadoop.classification.InterfaceAudience;
024import org.apache.hadoop.classification.InterfaceStability;
025import org.apache.hadoop.record.RecordOutput;
026
027/** 
028 * Represents typeID for vector. 
029 * @deprecated Replaced by <a href="https://hadoop.apache.org/avro/">Avro</a>.
030 */
031@Deprecated
032@InterfaceAudience.Public
033@InterfaceStability.Stable
034public class VectorTypeID extends TypeID {
035  private TypeID typeIDElement; 
036  
037  public VectorTypeID(TypeID typeIDElement) {
038    super(RIOType.VECTOR);
039    this.typeIDElement = typeIDElement;
040  }
041  
042  public TypeID getElementTypeID() {
043    return this.typeIDElement;
044  }
045  
046  void write(RecordOutput rout, String tag) throws IOException {
047    rout.writeByte(typeVal, tag);
048    typeIDElement.write(rout, tag);
049  }
050  
051  /**
052   * Two vector typeIDs are equal if their constituent elements have the 
053   * same type
054   */
055  public boolean equals(Object o) {
056    if (!super.equals (o))
057      return false;
058
059    VectorTypeID vti = (VectorTypeID) o;
060    return this.typeIDElement.equals(vti.typeIDElement);
061  }
062  
063  /**
064   * We use a basic hashcode implementation, since this class will likely not
065   * be used as a hashmap key 
066   */
067  public int hashCode() {
068    return 37*17+typeIDElement.hashCode();
069  }
070  
071}