source: proiecte/HadoopJUnit/hadoop-0.20.1/src/core/org/apache/hadoop/record/meta/VectorTypeID.java @ 120

Last change on this file since 120 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1/**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19package org.apache.hadoop.record.meta;
20
21import java.io.IOException;
22
23import org.apache.hadoop.record.RecordOutput;
24
25/**
26 * Represents typeID for vector.
27 */
28public class VectorTypeID extends TypeID {
29  private TypeID typeIDElement; 
30 
31  public VectorTypeID(TypeID typeIDElement) {
32    super(RIOType.VECTOR);
33    this.typeIDElement = typeIDElement;
34  }
35 
36  public TypeID getElementTypeID() {
37    return this.typeIDElement;
38  }
39 
40  void write(RecordOutput rout, String tag) throws IOException {
41    rout.writeByte(typeVal, tag);
42    typeIDElement.write(rout, tag);
43  }
44 
45  /**
46   * Two vector typeIDs are equal if their constituent elements have the
47   * same type
48   */
49  public boolean equals(Object o) {
50    if (!super.equals (o))
51      return false;
52
53    VectorTypeID vti = (VectorTypeID) o;
54    return this.typeIDElement.equals(vti.typeIDElement);
55  }
56 
57  /**
58   * We use a basic hashcode implementation, since this class will likely not
59   * be used as a hashmap key
60   */
61  public int hashCode() {
62    return 37*17+typeIDElement.hashCode();
63  }
64 
65}
Note: See TracBrowser for help on using the repository browser.