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 java.util.Objects;
11 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
14 * The <code>helper</code> implementation of Instance Rewision Aware XPath
17 * @see RevisionAwareXPath
19 public class RevisionAwareXPathImpl implements RevisionAwareXPath {
21 private final String xpath;
22 private final boolean absolute;
24 private static final int HASH_BOOLEAN_TRUE = 1231;
25 private static final int HASH_BOOLEAN_FALSE = 1237;
27 public RevisionAwareXPathImpl(final String xpath, final boolean absolute) {
29 this.absolute = absolute;
33 public boolean isAbsolute() {
38 public int hashCode() {
41 result = prime * result + Objects.hashCode(xpath);
42 result = prime * result + (absolute ? HASH_BOOLEAN_TRUE : HASH_BOOLEAN_FALSE);
47 public boolean equals(final Object obj) {
54 if (getClass() != obj.getClass()) {
57 RevisionAwareXPathImpl other = (RevisionAwareXPathImpl) obj;
58 return absolute == other.absolute && Objects.equals(xpath, other.xpath);
62 public String toString() {