All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.yangtools.yang.xpath.api.YangNegateExpr Maven / Gradle / Ivy

There is a newer version: 14.0.4
Show newest version
/*
 * 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 + ")";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy