org.opendaylight.yangtools.yang.xpath.api.YangNegateExpr Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yang-xpath-api Show documentation
Show all versions of yang-xpath-api Show documentation
YANG XPath ${project.artifactId}
/*
* Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.yangtools.yang.xpath.api;
import static java.util.Objects.requireNonNull;
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.Nullable;
@Beta
public final class YangNegateExpr implements YangExpr {
private static final long serialVersionUID = 1L;
private final YangExpr subExpr;
private YangNegateExpr(final YangExpr subExpr) {
this.subExpr = requireNonNull(subExpr);
}
public static YangNegateExpr of(final YangExpr subExpr) {
return new YangNegateExpr(subExpr);
}
public YangExpr getSubExpr() {
return subExpr;
}
@Override
public int hashCode() {
return subExpr.hashCode();
}
@Override
public boolean equals(final @Nullable Object obj) {
return this == obj || obj instanceof YangNegateExpr && subExpr.equals(((YangNegateExpr) obj).subExpr);
}
@Override
public String toString() {
return "-(" + subExpr + ")";
}
}