OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2014, the Dart project authors. |
| 3 * |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 5 * in compliance with the License. You may obtain a copy of the License at |
| 6 * |
| 7 * http://www.eclipse.org/legal/epl-v10.html |
| 8 * |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
| 12 * the License. |
| 13 */ |
| 14 package com.google.dart.engine.internal.index.file; |
| 15 |
| 16 import com.google.dart.engine.element.Element; |
| 17 import com.google.dart.engine.index.Location; |
| 18 import com.google.dart.engine.index.Relationship; |
| 19 |
| 20 /** |
| 21 * An {@link Element} to {@link Location} relation key. |
| 22 * |
| 23 * @coverage dart.engine.index |
| 24 */ |
| 25 public class RelationKeyData { |
| 26 final int elementId; |
| 27 final int relationshipId; |
| 28 |
| 29 public RelationKeyData(ElementCodec elementCodec, RelationshipCodec relationsh
ipCodec, |
| 30 Element element, Relationship relationship) { |
| 31 this.elementId = elementCodec.encode(element); |
| 32 this.relationshipId = relationshipCodec.encode(relationship); |
| 33 } |
| 34 |
| 35 public RelationKeyData(int elementId, int relationshipId) { |
| 36 this.elementId = elementId; |
| 37 this.relationshipId = relationshipId; |
| 38 } |
| 39 |
| 40 @Override |
| 41 public boolean equals(Object obj) { |
| 42 if (!(obj instanceof RelationKeyData)) { |
| 43 return false; |
| 44 } |
| 45 RelationKeyData other = (RelationKeyData) obj; |
| 46 return other.elementId == elementId && other.relationshipId == relationshipI
d; |
| 47 } |
| 48 |
| 49 @Override |
| 50 public int hashCode() { |
| 51 return 31 * elementId + relationshipId; |
| 52 } |
| 53 } |
OLD | NEW |