2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.model.util;
10 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
13 * The <code>default</code> implementation of Instance Rewision Aware XPath
16 * @see RevisionAwareXPath
18 public class RevisionAwareXPathImpl implements RevisionAwareXPath {
20 private final String xpath;
21 private final boolean absolute;
23 private static final int HASH_BOOLEAN_TRUE = 1231;
24 private static final int HASH_BOOLEAN_FALSE = 1237;
26 public RevisionAwareXPathImpl(String xpath, boolean absolute) {
28 this.absolute = absolute;
32 public boolean isAbsolute() {
37 public int hashCode() {
40 result = prime * result + ((xpath == null) ? 0 : xpath.hashCode());
41 result = prime * result + (absolute ? HASH_BOOLEAN_TRUE : HASH_BOOLEAN_FALSE);
46 public boolean equals(Object obj) {
53 if (getClass() != obj.getClass()) {
56 RevisionAwareXPathImpl other = (RevisionAwareXPathImpl) obj;
58 if (other.xpath != null) {
61 } else if (!xpath.equals(other.xpath)) {
64 if (absolute != other.absolute) {
71 public String toString() {